diff --git a/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java b/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java index 8357ce447..c5b727633 100644 --- a/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java +++ b/boms/extras/src/it/extras-usage-test/src/main/java/org/a2aproject/sdk/test/ExtrasBomVerifier.java @@ -17,6 +17,7 @@ public class ExtrasBomVerifier extends DynamicBomVerifier { "tck/", // TCK test suite "tests/", // Integration tests "test-utils-docker/", // Test utilities for Docker-based tests + "compat-0.3/", // Compat 0.3 modules (part of SDK BOM, not extras BOM) "extras/queue-manager-replicated/tests-multi-instance/", // Test harness applications "extras/queue-manager-replicated/tests-single-instance/", // Test harness applications "extras/opentelemetry/integration-tests/" // Test harness applications diff --git a/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java b/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java index 6b20bb50e..d25473846 100644 --- a/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java +++ b/boms/reference/src/it/reference-usage-test/src/main/java/org/a2aproject/sdk/test/ReferenceBomVerifier.java @@ -16,7 +16,8 @@ public class ReferenceBomVerifier extends DynamicBomVerifier { "examples/", // Example applications "tck/", // TCK test suite "tests/", // Integration tests - "test-utils-docker/" // Test utilities for Docker-based tests + "test-utils-docker/", // Test utilities for Docker-based tests + "compat-0.3/" // Compat 0.3 modules (part of SDK BOM, not reference BOM) // Note: reference/ is NOT in this list - we want to verify those classes load ); diff --git a/boms/sdk/pom.xml b/boms/sdk/pom.xml index cbc5fb075..0ad2031ab 100644 --- a/boms/sdk/pom.xml +++ b/boms/sdk/pom.xml @@ -108,6 +108,91 @@ ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + ${project.version} + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + ${project.version} + + ${project.groupId} diff --git a/boms/sdk/src/it/sdk-usage-test/pom.xml b/boms/sdk/src/it/sdk-usage-test/pom.xml index 5da56e93e..6ed3768bb 100644 --- a/boms/sdk/src/it/sdk-usage-test/pom.xml +++ b/boms/sdk/src/it/sdk-usage-test/pom.xml @@ -103,6 +103,76 @@ a2a-java-sdk-transport-rest + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-spec + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-spec-grpc + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-http-client + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-spi + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-client-transport-rest + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-transport-rest + + + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-common + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-jsonrpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-grpc + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-reference-rest + + org.slf4j diff --git a/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java b/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java index f69d70b85..7f0607b8d 100644 --- a/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java +++ b/boms/sdk/src/it/sdk-usage-test/src/main/java/org/a2aproject/sdk/test/SdkBomVerifier.java @@ -15,6 +15,7 @@ public class SdkBomVerifier extends DynamicBomVerifier { "boms/", // BOM test modules themselves "examples/", // Example applications "tck/", // TCK test suite + "compat-0.3/tck/", // Compat 0.3 TCK (not yet enabled) "tests/", // Integration tests "test-utils-docker/" // Test utilities for Docker-based tests ); diff --git a/compat-0.3/client/base/pom.xml b/compat-0.3/client/base/pom.xml new file mode 100644 index 000000000..d25627f63 --- /dev/null +++ b/compat-0.3/client/base/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-client + + jar + + Java SDK A2A Compat 0.3 Client + Java SDK for the Agent2Agent Protocol (A2A) - Client + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + test + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + test + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + org.slf4j + slf4j-jdk14 + test + + + io.grpc + grpc-testing + test + + + io.grpc + grpc-inprocess + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A.java new file mode 100644 index 000000000..48921f535 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/A2A.java @@ -0,0 +1,189 @@ +package org.a2aproject.sdk.compat03; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.TextPart; + + +/** + * Constants and utility methods related to the A2A protocol. + */ +public class A2A { + + /** + * Convert the given text to a user message. + * + * @param text the message text + * @return the user message + */ + public static Message toUserMessage(String text) { + return toMessage(text, Message.Role.USER, null); + } + + /** + * Convert the given text to a user message. + * + * @param text the message text + * @param messageId the message ID to use + * @return the user message + */ + public static Message toUserMessage(String text, String messageId) { + return toMessage(text, Message.Role.USER, messageId); + } + + /** + * Convert the given text to an agent message. + * + * @param text the message text + * @return the agent message + */ + public static Message toAgentMessage(String text) { + return toMessage(text, Message.Role.AGENT, null); + } + + /** + * Convert the given text to an agent message. + * + * @param text the message text + * @param messageId the message ID to use + * @return the agent message + */ + public static Message toAgentMessage(String text, String messageId) { + return toMessage(text, Message.Role.AGENT, messageId); + } + + /** + * Create a user message with text content and optional context and task IDs. + * + * @param text the message text (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the user message + */ + public static Message createUserTextMessage(String text, String contextId, String taskId) { + return toMessage(text, Message.Role.USER, null, contextId, taskId); + } + + /** + * Create an agent message with text content and optional context and task IDs. + * + * @param text the message text (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the agent message + */ + public static Message createAgentTextMessage(String text, String contextId, String taskId) { + return toMessage(text, Message.Role.AGENT, null, contextId, taskId); + } + + /** + * Create an agent message with custom parts and optional context and task IDs. + * + * @param parts the message parts (required) + * @param contextId the context ID to use (optional) + * @param taskId the task ID to use (optional) + * @return the agent message + */ + public static Message createAgentPartsMessage(List> parts, String contextId, String taskId) { + if (parts == null || parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be null or empty"); + } + return toMessage(parts, Message.Role.AGENT, null, contextId, taskId); + } + + private static Message toMessage(String text, Message.Role role, String messageId) { + return toMessage(text, role, messageId, null, null); + } + + private static Message toMessage(String text, Message.Role role, String messageId, String contextId, String taskId) { + Message.Builder messageBuilder = new Message.Builder() + .role(role) + .parts(Collections.singletonList(new TextPart(text))) + .contextId(contextId) + .taskId(taskId); + if (messageId != null) { + messageBuilder.messageId(messageId); + } + return messageBuilder.build(); + } + + private static Message toMessage(List> parts, Message.Role role, String messageId, String contextId, String taskId) { + Message.Builder messageBuilder = new Message.Builder() + .role(role) + .parts(parts) + .contextId(contextId) + .taskId(taskId); + if (messageId != null) { + messageBuilder.messageId(messageId); + } + return messageBuilder.build(); + } + + /** + * Get the agent card for an A2A agent. + * + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @return the agent card + * @throws A2AClientError If an HTTP error occurs fetching the card + * @throws A2AClientJSONError If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard getAgentCard(String agentUrl) throws A2AClientError, A2AClientJSONError { + return getAgentCard(new JdkA2AHttpClient(), agentUrl); + } + + /** + * Get the agent card for an A2A agent. + * + * @param httpClient the http client to use + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @return the agent card + * @throws A2AClientError If an HTTP error occurs fetching the card + * @throws A2AClientJSONError If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard getAgentCard(A2AHttpClient httpClient, String agentUrl) throws A2AClientError, A2AClientJSONError { + return getAgentCard(httpClient, agentUrl, null, null); + } + + /** + * Get the agent card for an A2A agent. + * + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @param relativeCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use + * @return the agent card + * @throws A2AClientError If an HTTP error occurs fetching the card + * @throws A2AClientJSONError If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard getAgentCard(String agentUrl, String relativeCardPath, Map authHeaders) throws A2AClientError, A2AClientJSONError { + return getAgentCard(new JdkA2AHttpClient(), agentUrl, relativeCardPath, authHeaders); + } + + /** + * Get the agent card for an A2A agent. + * + * @param httpClient the http client to use + * @param agentUrl the base URL for the agent whose agent card we want to retrieve + * @param relativeCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use + * @return the agent card + * @throws A2AClientError If an HTTP error occurs fetching the card + * @throws A2AClientJSONError If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public static AgentCard getAgentCard(A2AHttpClient httpClient, String agentUrl, String relativeCardPath, Map authHeaders) throws A2AClientError, A2AClientJSONError { + A2ACardResolver resolver = new A2ACardResolver(httpClient, agentUrl, relativeCardPath, authHeaders); + return resolver.getAgentCard(); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient.java new file mode 100644 index 000000000..931d50825 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/AbstractClient.java @@ -0,0 +1,392 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +/** + * Abstract class representing an A2A client. Provides a standard set + * of methods for interacting with an A2A agent, regardless of the underlying + * transport protocol. It supports sending messages, managing tasks, and + * handling event streams. + */ +public abstract class AbstractClient { + + private final List> consumers; + private final @Nullable Consumer streamingErrorHandler; + + public AbstractClient(List> consumers) { + this(consumers, null); + } + + public AbstractClient(@NonNull List> consumers, @Nullable Consumer streamingErrorHandler) { + checkNotNullParam("consumers", consumers); + this.consumers = consumers; + this.streamingErrorHandler = streamingErrorHandler; + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @throws A2AClientException if sending the message fails for any reason + */ + public void sendMessage(Message request) throws A2AClientException { + sendMessage(request, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if sending the message fails for any reason + */ + public abstract void sendMessage(Message request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The specified client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The specified streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @throws A2AClientException if sending the message fails for any reason + */ + public void sendMessage(Message request, + List> consumers, + Consumer streamingErrorHandler) throws A2AClientException { + sendMessage(request, consumers, streamingErrorHandler, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The specified client consumers + * will be used to handle messages, tasks, and update events received + * from the remote agent. The specified streaming error handler will be used + * if an error occurs during streaming. The configured client push notification + * configuration will get used for streaming. + * + * @param request the message + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if sending the message fails for any reason + */ + public abstract void sendMessage(Message request, + List> consumers, + Consumer streamingErrorHandler, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received from + * the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. + * + * @param request the message + * @param pushNotificationConfiguration the push notification configuration that should be + * used if the streaming approach is used + * @param metadata the optional metadata to include when sending the message + * @throws A2AClientException if sending the message fails for any reason + */ + public void sendMessage(Message request, PushNotificationConfig pushNotificationConfiguration, + Map metadata) throws A2AClientException { + sendMessage(request, pushNotificationConfiguration, metadata, null); + } + + /** + * Send a message to the remote agent. This method will automatically use + * the streaming or non-streaming approach as determined by the server's + * agent card and the client configuration. The configured client consumers + * will be used to handle messages, tasks, and update events received from + * the remote agent. The configured streaming error handler will be used + * if an error occurs during streaming. + * + * @param request the message + * @param pushNotificationConfiguration the push notification configuration that should be + * used if the streaming approach is used + * @param metadata the optional metadata to include when sending the message + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if sending the message fails for any reason + */ + public abstract void sendMessage(Message request, PushNotificationConfig pushNotificationConfiguration, + Map metadata, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @return the task + * @throws A2AClientException if retrieving the task fails for any reason + */ + public Task getTask(TaskQueryParams request) throws A2AClientException { + return getTask(request, null); + } + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task + * @throws A2AClientException if retrieving the task fails for any reason + */ + public abstract Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @return the cancelled task + * @throws A2AClientException if cancelling the task fails for any reason + */ + public Task cancelTask(TaskIdParams request) throws A2AClientException { + return cancelTask(request, null); + } + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @param context optional client call context for the request (may be {@code null}) + * @return the cancelled task + * @throws A2AClientException if cancelling the task fails for any reason + */ + public abstract Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException if setting the task push notification configuration fails for any reason + */ + public TaskPushNotificationConfig setTaskPushNotificationConfiguration( + TaskPushNotificationConfig request) throws A2AClientException { + return setTaskPushNotificationConfiguration(request, null); + } + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @param context optional client call context for the request (may be {@code null}) + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException if setting the task push notification configuration fails for any reason + */ + public abstract TaskPushNotificationConfig setTaskPushNotificationConfiguration( + TaskPushNotificationConfig request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @return the task push notification config + * @throws A2AClientException if getting the task push notification config fails for any reason + */ + public TaskPushNotificationConfig getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams request) throws A2AClientException { + return getTaskPushNotificationConfiguration(request, null); + } + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task push notification config + * @throws A2AClientException if getting the task push notification config fails for any reason + */ + public abstract TaskPushNotificationConfig getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @return the list of task push notification configs + * @throws A2AClientException if getting the task push notification configs fails for any reason + */ + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request) throws A2AClientException { + return listTaskPushNotificationConfigurations(request, null); + } + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the list of task push notification configs + * @throws A2AClientException if getting the task push notification configs fails for any reason + */ + public abstract List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @throws A2AClientException if deleting the task push notification configs fails for any reason + */ + public void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams request) throws A2AClientException { + deleteTaskPushNotificationConfigurations(request, null); + } + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if deleting the task push notification configs fails for any reason + */ + public abstract void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The configured client consumers will be used to handle messages, tasks, + * and update events received from the remote agent. The configured streaming + * error handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @throws A2AClientException if resubscribing fails for any reason + */ + public void resubscribe(TaskIdParams request) throws A2AClientException { + resubscribe(request, null); + } + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The configured client consumers will be used to handle messages, tasks, + * and update events received from the remote agent. The configured streaming + * error handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if resubscribing fails for any reason + */ + public abstract void resubscribe(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The specified client consumers will be used to handle messages, tasks, and + * update events received from the remote agent. The specified streaming error + * handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @throws A2AClientException if resubscribing fails for any reason + */ + public void resubscribe(TaskIdParams request, List> consumers, + Consumer streamingErrorHandler) throws A2AClientException { + resubscribe(request, consumers, streamingErrorHandler, null); + } + + /** + * Resubscribe to a task's event stream. + * This is only available if both the client and server support streaming. + * The specified client consumers will be used to handle messages, tasks, and + * update events received from the remote agent. The specified streaming error + * handler will be used if an error occurs during streaming. + * + * @param request the parameters specifying which task's notification configs to delete + * @param consumers a list of consumers to pass responses from the remote agent to + * @param streamingErrorHandler an error handler that should be used for the streaming case if an error occurs + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if resubscribing fails for any reason + */ + public abstract void resubscribe(TaskIdParams request, List> consumers, + Consumer streamingErrorHandler, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the AgentCard. + * + * @return the AgentCard + * @throws A2AClientException if retrieving the agent card fails for any reason + */ + public AgentCard getAgentCard() throws A2AClientException { + return getAgentCard(null); + } + + /** + * Retrieve the AgentCard. + * + * @param context optional client call context for the request (may be {@code null}) + * @return the AgentCard + * @throws A2AClientException if retrieving the agent card fails for any reason + */ + public abstract AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException; + + /** + * Close the transport and release any associated resources. + */ + public abstract void close(); + + /** + * Process the event using all configured consumers. + */ + void consume(ClientEvent clientEventOrMessage, AgentCard agentCard) { + for (BiConsumer consumer : consumers) { + consumer.accept(clientEventOrMessage, agentCard); + } + } + + /** + * Get the error handler that should be used during streaming. + * + * @return the streaming error handler + */ + public @Nullable Consumer getStreamingErrorHandler() { + return streamingErrorHandler; + } + +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client.java new file mode 100644 index 000000000..2623527ee --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/Client.java @@ -0,0 +1,243 @@ +package org.a2aproject.sdk.compat03.client; + +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidStateError; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +public class Client extends AbstractClient { + + private final ClientConfig clientConfig; + private final ClientTransport clientTransport; + private AgentCard agentCard; + + Client(AgentCard agentCard, ClientConfig clientConfig, ClientTransport clientTransport, + List> consumers, @Nullable Consumer streamingErrorHandler) { + super(consumers, streamingErrorHandler); + checkNotNullParam("agentCard", agentCard); + + this.agentCard = agentCard; + this.clientConfig = clientConfig; + this.clientTransport = clientTransport; + } + + public static ClientBuilder builder(AgentCard agentCard) { + return new ClientBuilder(agentCard); + } + + @Override + public void sendMessage(Message request, @Nullable ClientCallContext context) throws A2AClientException { + MessageSendParams messageSendParams = getMessageSendParams(request, clientConfig); + sendMessage(messageSendParams, null, null, context); + } + + @Override + public void sendMessage(Message request, List> consumers, + Consumer streamingErrorHandler, @Nullable ClientCallContext context) throws A2AClientException { + MessageSendParams messageSendParams = getMessageSendParams(request, clientConfig); + sendMessage(messageSendParams, consumers, streamingErrorHandler, context); + } + + @Override + public void sendMessage(Message request, PushNotificationConfig pushNotificationConfiguration, + Map metatadata, @Nullable ClientCallContext context) throws A2AClientException { + MessageSendConfiguration messageSendConfiguration = createMessageSendConfiguration(pushNotificationConfiguration); + + MessageSendParams messageSendParams = new MessageSendParams.Builder() + .message(request) + .configuration(messageSendConfiguration) + .metadata(metatadata) + .build(); + + sendMessage(messageSendParams, null, null, context); + } + + @Override + public Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException { + return clientTransport.getTask(request, context); + } + + @Override + public Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException { + return clientTransport.cancelTask(request, context); + } + + @Override + public TaskPushNotificationConfig setTaskPushNotificationConfiguration( + TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException { + return clientTransport.setTaskPushNotificationConfiguration(request, context); + } + + @Override + public TaskPushNotificationConfig getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + return clientTransport.getTaskPushNotificationConfiguration(request, context); + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + return clientTransport.listTaskPushNotificationConfigurations(request, context); + } + + @Override + public void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + clientTransport.deleteTaskPushNotificationConfigurations(request, context); + } + + @Override + public void resubscribe(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException { + resubscribeToTask(request, null, null, context); + } + + @Override + public void resubscribe(TaskIdParams request, @Nullable List> consumers, + @Nullable Consumer streamingErrorHandler, @Nullable ClientCallContext context) throws A2AClientException { + resubscribeToTask(request, consumers, streamingErrorHandler, context); + } + + @Override + public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException { + agentCard = clientTransport.getAgentCard(context); + return agentCard; + } + + @Override + public void close() { + clientTransport.close(); + } + + private ClientEvent getClientEvent(StreamingEventKind event, ClientTaskManager taskManager) throws A2AClientError { + if (event instanceof Message message) { + return new MessageEvent(message); + } else if (event instanceof Task task) { + taskManager.saveTaskEvent(task); + return new TaskEvent(taskManager.getCurrentTask()); + } else if (event instanceof TaskStatusUpdateEvent updateEvent) { + taskManager.saveTaskEvent(updateEvent); + return new TaskUpdateEvent(taskManager.getCurrentTask(), updateEvent); + } else if (event instanceof TaskArtifactUpdateEvent updateEvent) { + taskManager.saveTaskEvent(updateEvent); + return new TaskUpdateEvent(taskManager.getCurrentTask(), updateEvent); + } else { + throw new A2AClientInvalidStateError("Invalid client event"); + } + } + + private MessageSendConfiguration createMessageSendConfiguration(@Nullable PushNotificationConfig pushNotificationConfig) { + return new MessageSendConfiguration.Builder() + .acceptedOutputModes(clientConfig.getAcceptedOutputModes()) + .blocking(!clientConfig.isPolling()) + .historyLength(clientConfig.getHistoryLength()) + .pushNotificationConfig(pushNotificationConfig) + .build(); + } + + private void sendMessage(MessageSendParams messageSendParams, @Nullable List> consumers, + @Nullable Consumer errorHandler, @Nullable ClientCallContext context) throws A2AClientException { + if (! clientConfig.isStreaming() || ! agentCard.capabilities().streaming()) { + EventKind eventKind = clientTransport.sendMessage(messageSendParams, context); + ClientEvent clientEvent; + if (eventKind instanceof Task task) { + clientEvent = new TaskEvent(task); + } else { + // must be a message + clientEvent = new MessageEvent((Message) eventKind); + } + consume(clientEvent, agentCard, consumers); + } else { + ClientTaskManager tracker = new ClientTaskManager(); + Consumer overriddenErrorHandler = getOverriddenErrorHandler(errorHandler); + Consumer eventHandler = event -> { + try { + ClientEvent clientEvent = getClientEvent(event, tracker); + consume(clientEvent, agentCard, consumers); + } catch (A2AClientError e) { + overriddenErrorHandler.accept(e); + } + }; + clientTransport.sendMessageStreaming(messageSendParams, eventHandler, overriddenErrorHandler, context); + } + } + + private void resubscribeToTask(TaskIdParams request, @Nullable List> consumers, + @Nullable Consumer errorHandler, @Nullable ClientCallContext context) throws A2AClientException { + if (! clientConfig.isStreaming() || ! agentCard.capabilities().streaming()) { + throw new A2AClientException("Client and/or server does not support resubscription"); + } + ClientTaskManager tracker = new ClientTaskManager(); + Consumer overriddenErrorHandler = getOverriddenErrorHandler(errorHandler); + Consumer eventHandler = event -> { + try { + ClientEvent clientEvent = getClientEvent(event, tracker); + consume(clientEvent, agentCard, consumers); + } catch (A2AClientError e) { + overriddenErrorHandler.accept(e); + } + }; + clientTransport.resubscribe(request, eventHandler, overriddenErrorHandler, context); + } + + private @NonNull Consumer getOverriddenErrorHandler(@Nullable Consumer errorHandler) { + return e -> { + if (errorHandler != null) { + errorHandler.accept(e); + } else { + if (getStreamingErrorHandler() != null) { + getStreamingErrorHandler().accept(e); + } + } + }; + } + + private void consume(ClientEvent clientEvent, AgentCard agentCard, @Nullable List> consumers) { + if (consumers != null) { + // use specified consumers + for (BiConsumer consumer : consumers) { + consumer.accept(clientEvent, agentCard); + } + } else { + // use configured consumers + consume(clientEvent, agentCard); + } + } + + private MessageSendParams getMessageSendParams(Message request, ClientConfig clientConfig) { + MessageSendConfiguration messageSendConfiguration = createMessageSendConfiguration(clientConfig.getPushNotificationConfig()); + + return new MessageSendParams.Builder() + .message(request) + .configuration(messageSendConfiguration) + .metadata(clientConfig.getMetadata()) + .build(); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder.java new file mode 100644 index 000000000..24443bbb8 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientBuilder.java @@ -0,0 +1,169 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +public class ClientBuilder { + + private static final Map>> transportProviderRegistry = new HashMap<>(); + private static final Map, String> transportProtocolMapping = new HashMap<>(); + + static { + ServiceLoader loader = ServiceLoader.load(ClientTransportProvider.class); + for (ClientTransportProvider transport : loader) { + transportProviderRegistry.put(transport.getTransportProtocol(), transport); + transportProtocolMapping.put(transport.getTransportProtocolClass(), transport.getTransportProtocol()); + } + } + + private final AgentCard agentCard; + + private final List> consumers = new ArrayList<>(); + private @Nullable Consumer streamErrorHandler; + private ClientConfig clientConfig = new ClientConfig.Builder().build(); + + private final Map, ClientTransportConfig> clientTransports = new LinkedHashMap<>(); + + ClientBuilder(@NonNull AgentCard agentCard) { + this.agentCard = agentCard; + } + + public ClientBuilder withTransport(Class clazz, ClientTransportConfigBuilder, ?> configBuilder) { + return withTransport(clazz, configBuilder.build()); + } + + public ClientBuilder withTransport(Class clazz, ClientTransportConfig config) { + clientTransports.put(clazz, config); + + return this; + } + + public ClientBuilder addConsumer(BiConsumer consumer) { + this.consumers.add(consumer); + return this; + } + + public ClientBuilder addConsumers(List> consumers) { + this.consumers.addAll(consumers); + return this; + } + + public ClientBuilder streamingErrorHandler(Consumer streamErrorHandler) { + this.streamErrorHandler = streamErrorHandler; + return this; + } + + public ClientBuilder clientConfig(@NonNull ClientConfig clientConfig) { + this.clientConfig = clientConfig; + return this; + } + + public Client build() throws A2AClientException { + if (this.clientConfig == null) { + this.clientConfig = new ClientConfig.Builder().build(); + } + + ClientTransport clientTransport = buildClientTransport(); + + return new Client(agentCard, clientConfig, clientTransport, consumers, streamErrorHandler); + } + + @SuppressWarnings("unchecked") + private ClientTransport buildClientTransport() throws A2AClientException { + // Get the preferred transport + AgentInterface agentInterface = findBestClientTransport(); + + // Get the transport provider associated with the protocol + ClientTransportProvider clientTransportProvider = transportProviderRegistry.get(agentInterface.transport()); + if (clientTransportProvider == null) { + throw new A2AClientException("No client available for " + agentInterface.transport()); + } + Class transportProtocolClass = clientTransportProvider.getTransportProtocolClass(); + + // Retrieve the configuration associated with the preferred transport + ClientTransportConfig clientTransportConfig = clientTransports.get(transportProtocolClass); + + if (clientTransportConfig == null) { + throw new A2AClientException("Missing required TransportConfig for " + agentInterface.transport()); + } + + return clientTransportProvider.create(clientTransportConfig, agentCard, agentInterface.url()); + } + + private Map getServerPreferredTransports() { + Map serverPreferredTransports = new LinkedHashMap<>(); + serverPreferredTransports.put(agentCard.preferredTransport(), agentCard.url()); + if (agentCard.additionalInterfaces() != null) { + for (AgentInterface agentInterface : agentCard.additionalInterfaces()) { + serverPreferredTransports.putIfAbsent(agentInterface.transport(), agentInterface.url()); + } + } + return serverPreferredTransports; + } + + private List getClientPreferredTransports() { + List supportedClientTransports = new ArrayList<>(); + + if (clientTransports.isEmpty()) { + // default to JSONRPC if not specified + supportedClientTransports.add(TransportProtocol.JSONRPC.asString()); + } else { + clientTransports.forEach((aClass, clientTransportConfig) -> supportedClientTransports.add(transportProtocolMapping.get(aClass))); + } + return supportedClientTransports; + } + + private AgentInterface findBestClientTransport() throws A2AClientException { + // Retrieve transport supported by the A2A server + Map serverPreferredTransports = getServerPreferredTransports(); + + // Retrieve transport configured for this client (using withTransport methods) + List clientPreferredTransports = getClientPreferredTransports(); + + String transportProtocol = null; + String transportUrl = null; + if (clientConfig.isUseClientPreference()) { + for (String clientPreferredTransport : clientPreferredTransports) { + if (serverPreferredTransports.containsKey(clientPreferredTransport)) { + transportProtocol = clientPreferredTransport; + transportUrl = serverPreferredTransports.get(transportProtocol); + break; + } + } + } else { + for (Map.Entry transport : serverPreferredTransports.entrySet()) { + if (clientPreferredTransports.contains(transport.getKey())) { + transportProtocol = transport.getKey(); + transportUrl = transport.getValue(); + break; + } + } + } + if (transportProtocol == null || transportUrl == null) { + throw new A2AClientException("No compatible transport found"); + } + if (! transportProviderRegistry.containsKey(transportProtocol)) { + throw new A2AClientException("No client available for " + transportProtocol); + } + + return new AgentInterface(transportProtocol, transportUrl); + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent.java new file mode 100644 index 000000000..ffaf18cd6 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientEvent.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.client; + +public sealed interface ClientEvent permits MessageEvent, TaskEvent, TaskUpdateEvent { +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager.java new file mode 100644 index 000000000..b3604b53d --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/ClientTaskManager.java @@ -0,0 +1,139 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.compat03.util.Utils.appendArtifactToTask; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidArgsError; +import org.a2aproject.sdk.compat03.spec.A2AClientInvalidStateError; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.jspecify.annotations.Nullable; + +/** + * Helps manage a task's lifecycle during the execution of a request. + * Responsible for retrieving, saving, and updating the task based on + * events received from the agent. + */ +public class ClientTaskManager { + + private @Nullable Task currentTask; + private @Nullable String taskId; + private @Nullable String contextId; + + public ClientTaskManager() { + this.currentTask = null; + this.taskId = null; + this.contextId = null; + } + + public Task getCurrentTask() throws A2AClientInvalidStateError { + if (currentTask == null) { + throw new A2AClientInvalidStateError("No current task"); + } + return currentTask; + } + + public Task saveTaskEvent(Task task) throws A2AClientInvalidArgsError { + if (currentTask != null) { + throw new A2AClientInvalidArgsError("Task is already set, create new manager for new tasks."); + } + saveTask(task); + return task; + } + + public Task saveTaskEvent(TaskStatusUpdateEvent taskStatusUpdateEvent) throws A2AClientError { + if (taskId == null) { + taskId = taskStatusUpdateEvent.getTaskId(); + } + if (contextId == null) { + contextId = taskStatusUpdateEvent.getContextId(); + } + Task task = currentTask; + if (task == null) { + task = new Task.Builder() + .status(new TaskStatus(TaskState.UNKNOWN)) + .id(taskId) + .contextId(contextId == null ? "" : contextId) + .build(); + } + + Task.Builder taskBuilder = new Task.Builder(task); + if (taskStatusUpdateEvent.getStatus().message() != null) { + if (task.getHistory() == null) { + taskBuilder.history(taskStatusUpdateEvent.getStatus().message()); + } else { + List history = new ArrayList<>(task.getHistory()); + history.add(taskStatusUpdateEvent.getStatus().message()); + taskBuilder.history(history); + } + } + if (taskStatusUpdateEvent.getMetadata() != null) { + Map newMetadata = task.getMetadata() != null ? new HashMap<>(task.getMetadata()) : new HashMap<>(); + newMetadata.putAll(taskStatusUpdateEvent.getMetadata()); + taskBuilder.metadata(newMetadata); + } + taskBuilder.status(taskStatusUpdateEvent.getStatus()); + currentTask = taskBuilder.build(); + return currentTask; + } + + public Task saveTaskEvent(TaskArtifactUpdateEvent taskArtifactUpdateEvent) { + if (taskId == null) { + taskId = taskArtifactUpdateEvent.getTaskId(); + } + if (contextId == null) { + contextId = taskArtifactUpdateEvent.getContextId(); + } + Task task = currentTask; + if (task == null) { + task = new Task.Builder() + .status(new TaskStatus(TaskState.UNKNOWN)) + .id(taskId) + .contextId(contextId == null ? "" : contextId) + .build(); + } + currentTask = appendArtifactToTask(task, taskArtifactUpdateEvent, taskId); + return currentTask; + } + + /** + * Update a task by adding a message to its history. If the task has a message in its current status, + * that message is moved to the history first. + * + * @param message the new message to add to the history + * @param task the task to update + * @return the updated task + */ + public Task updateWithMessage(Message message, Task task) { + Task.Builder taskBuilder = new Task.Builder(task); + List history = task.getHistory(); + if (history == null) { + history = new ArrayList<>(); + } + if (task.getStatus().message() != null) { + history.add(task.getStatus().message()); + taskBuilder.status(new TaskStatus(task.getStatus().state(), null, task.getStatus().timestamp())); + } + history.add(message); + taskBuilder.history(history); + currentTask = taskBuilder.build(); + return currentTask; + } + + private void saveTask(Task task) { + currentTask = task; + if (taskId == null) { + taskId = currentTask.getId(); + contextId = currentTask.getContextId(); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent.java new file mode 100644 index 000000000..0c94bc95f --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/MessageEvent.java @@ -0,0 +1,26 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.spec.Message; + +/** + * A message event received by a client. + */ +public final class MessageEvent implements ClientEvent { + + private final Message message; + + /** + * A message event. + * + * @param message the message received + */ + public MessageEvent(Message message) { + this.message = message; + } + + public Message getMessage() { + return message; + } +} + + diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent.java new file mode 100644 index 000000000..1406ad619 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskEvent.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.spec.Task; + +/** + * A task event received by a client. + */ +public final class TaskEvent implements ClientEvent { + + private final Task task; + + /** + * A client task event. + * + * @param task the task received + */ + public TaskEvent(Task task) { + checkNotNullParam("task", task); + this.task = task; + } + + public Task getTask() { + return task; + } +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent.java new file mode 100644 index 000000000..1cd0aff23 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/TaskUpdateEvent.java @@ -0,0 +1,37 @@ +package org.a2aproject.sdk.compat03.client; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.UpdateEvent; + +/** + * A task update event received by a client. + */ +public final class TaskUpdateEvent implements ClientEvent { + + private final Task task; + private final UpdateEvent updateEvent; + + /** + * A task update event. + * + * @param task the current task + * @param updateEvent the update event received for the current task + */ + public TaskUpdateEvent(Task task, UpdateEvent updateEvent) { + checkNotNullParam("task", task); + checkNotNullParam("updateEvent", updateEvent); + this.task = task; + this.updateEvent = updateEvent; + } + + public Task getTask() { + return task; + } + + public UpdateEvent getUpdateEvent() { + return updateEvent; + } + +} diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig.java new file mode 100644 index 000000000..20dd1c991 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/ClientConfig.java @@ -0,0 +1,114 @@ +package org.a2aproject.sdk.compat03.client.config; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import java.util.ArrayList; +import java.util.HashMap; +import org.jspecify.annotations.Nullable; + +/** + * Configuration for the A2A client factory. + */ +public class ClientConfig { + + private final Boolean streaming; + private final Boolean polling; + private final Boolean useClientPreference; + private final List acceptedOutputModes; + private final @Nullable PushNotificationConfig pushNotificationConfig; + private final @Nullable Integer historyLength; + private final Map metadata; + + private ClientConfig(Builder builder) { + this.streaming = builder.streaming == null ? true : builder.streaming; + this.polling = builder.polling == null ? false : builder.polling; + this.useClientPreference = builder.useClientPreference == null ? false : builder.useClientPreference; + this.acceptedOutputModes = builder.acceptedOutputModes; + this.pushNotificationConfig = builder.pushNotificationConfig; + this.historyLength = builder.historyLength; + this.metadata = builder.metadata; + } + + public boolean isStreaming() { + return streaming; + } + + public boolean isPolling() { + return polling; + } + + public boolean isUseClientPreference() { + return useClientPreference; + } + + public List getAcceptedOutputModes() { + return acceptedOutputModes; + } + + public @Nullable PushNotificationConfig getPushNotificationConfig() { + return pushNotificationConfig; + } + + public @Nullable Integer getHistoryLength() { + return historyLength; + } + + public Map getMetadata() { + return metadata; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private @Nullable Boolean streaming; + private @Nullable Boolean polling; + private @Nullable Boolean useClientPreference; + private List acceptedOutputModes = new ArrayList<>(); + private @Nullable PushNotificationConfig pushNotificationConfig; + private @Nullable Integer historyLength; + private Map metadata = new HashMap<>(); + + public Builder setStreaming(@Nullable Boolean streaming) { + this.streaming = streaming; + return this; + } + + public Builder setPolling(@Nullable Boolean polling) { + this.polling = polling; + return this; + } + + public Builder setUseClientPreference(@Nullable Boolean useClientPreference) { + this.useClientPreference = useClientPreference; + return this; + } + + public Builder setAcceptedOutputModes(List acceptedOutputModes) { + this.acceptedOutputModes = new ArrayList<>(acceptedOutputModes); + return this; + } + + public Builder setPushNotificationConfig(PushNotificationConfig pushNotificationConfig) { + this.pushNotificationConfig = pushNotificationConfig; + return this; + } + + public Builder setHistoryLength(Integer historyLength) { + this.historyLength = historyLength; + return this; + } + + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public ClientConfig build() { + return new ClientConfig(this); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java new file mode 100644 index 000000000..bfae93f4b --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/config/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.config; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java new file mode 100644 index 000000000..9bd22f637 --- /dev/null +++ b/compat-0.3/client/base/src/main/java/org/a2aproject/sdk/compat03/client/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/base/src/main/resources/META-INF/beans.xml b/compat-0.3/client/base/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2ATest.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2ATest.java new file mode 100644 index 000000000..76c93df96 --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/A2ATest.java @@ -0,0 +1,147 @@ +package org.a2aproject.sdk.compat03; + +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +public class A2ATest { + + @Test + public void testToUserMessage() { + String text = "Hello, world!"; + Message message = A2A.toUserMessage(text); + + assertEquals(Message.Role.USER, message.getRole()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + assertNull(message.getContextId()); + assertNull(message.getTaskId()); + } + + @Test + public void testToUserMessageWithId() { + String text = "Hello, world!"; + String messageId = "test-message-id"; + Message message = A2A.toUserMessage(text, messageId); + + assertEquals(Message.Role.USER, message.getRole()); + assertEquals(messageId, message.getMessageId()); + } + + @Test + public void testToAgentMessage() { + String text = "Hello, I'm an agent!"; + Message message = A2A.toAgentMessage(text); + + assertEquals(Message.Role.AGENT, message.getRole()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + } + + @Test + public void testToAgentMessageWithId() { + String text = "Hello, I'm an agent!"; + String messageId = "agent-message-id"; + Message message = A2A.toAgentMessage(text, messageId); + + assertEquals(Message.Role.AGENT, message.getRole()); + assertEquals(messageId, message.getMessageId()); + } + + @Test + public void testCreateUserTextMessage() { + String text = "User message with context"; + String contextId = "context-123"; + String taskId = "task-456"; + + Message message = A2A.createUserTextMessage(text, contextId, taskId); + + assertEquals(Message.Role.USER, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + assertNull(message.getMetadata()); + assertNull(message.getReferenceTaskIds()); + } + + @Test + public void testCreateUserTextMessageWithNullParams() { + String text = "Simple user message"; + + Message message = A2A.createUserTextMessage(text, null, null); + + assertEquals(Message.Role.USER, message.getRole()); + assertNull(message.getContextId()); + assertNull(message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart) message.getParts().get(0)).getText()); + } + + @Test + public void testCreateAgentTextMessage() { + String text = "Agent message with context"; + String contextId = "context-789"; + String taskId = "task-012"; + + Message message = A2A.createAgentTextMessage(text, contextId, taskId); + + assertEquals(Message.Role.AGENT, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(1, message.getParts().size()); + assertEquals(text, ((TextPart) message.getParts().get(0)).getText()); + assertNotNull(message.getMessageId()); + } + + @Test + public void testCreateAgentPartsMessage() { + List> parts = Arrays.asList( + new TextPart("Part 1"), + new TextPart("Part 2") + ); + String contextId = "context-parts"; + String taskId = "task-parts"; + + Message message = A2A.createAgentPartsMessage(parts, contextId, taskId); + + assertEquals(Message.Role.AGENT, message.getRole()); + assertEquals(contextId, message.getContextId()); + assertEquals(taskId, message.getTaskId()); + assertEquals(2, message.getParts().size()); + assertEquals("Part 1", ((TextPart) message.getParts().get(0)).getText()); + assertEquals("Part 2", ((TextPart) message.getParts().get(1)).getText()); + } + + @Test + public void testCreateAgentPartsMessageWithNullParts() { + try { + A2A.createAgentPartsMessage(null, "context", "task"); + org.junit.jupiter.api.Assertions.fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertEquals("Parts cannot be null or empty", e.getMessage()); + } + } + + @Test + public void testCreateAgentPartsMessageWithEmptyParts() { + try { + A2A.createAgentPartsMessage(Collections.emptyList(), "context", "task"); + org.junit.jupiter.api.Assertions.fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + assertEquals("Parts cannot be null or empty", e.getMessage()); + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorizationTest.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorizationTest.java new file mode 100644 index 000000000..2d1764374 --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/AuthenticationAuthorizationTest.java @@ -0,0 +1,380 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransport; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportConfigBuilder; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransport; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfigBuilder; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransport; +import org.a2aproject.sdk.compat03.client.transport.rest.RestTransportConfigBuilder; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; +import io.grpc.ManagedChannel; +import io.grpc.Server; +import io.grpc.Status; +import io.grpc.inprocess.InProcessChannelBuilder; +import io.grpc.inprocess.InProcessServerBuilder; +import io.grpc.stub.StreamObserver; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; + +import java.io.IOException; +import java.util.Collections; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +/** + * Tests for handling HTTP 401 (Unauthorized) and 403 (Forbidden) responses + * when the client sends streaming and non-streaming messages. + * + * These tests verify that the client properly fails when the server returns + * authentication or authorization errors. + */ +public class AuthenticationAuthorizationTest { + + private static final String AGENT_URL = "http://localhost:4001"; + private static final String AUTHENTICATION_FAILED_MESSAGE = "Authentication failed"; + private static final String AUTHORIZATION_FAILED_MESSAGE = "Authorization failed"; + + private ClientAndServer server; + private Message MESSAGE; + private AgentCard agentCard; + private Server grpcServer; + private ManagedChannel grpcChannel; + private String grpcServerName; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + MESSAGE = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("test message"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + + grpcServerName = InProcessServerBuilder.generateName(); + + agentCard = new AgentCard.Builder() + .name("Test Agent") + .description("Test agent for auth tests") + .url(AGENT_URL) + .version("1.0.0") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) // Support streaming for all tests + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("test_skill") + .name("Test skill") + .description("Test skill") + .tags(Collections.singletonList("test")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(java.util.Arrays.asList( + new AgentInterface(TransportProtocol.JSONRPC.asString(), AGENT_URL), + new AgentInterface(TransportProtocol.HTTP_JSON.asString(), AGENT_URL), + new AgentInterface(TransportProtocol.GRPC.asString(), grpcServerName))) + .build(); + } + + @AfterEach + public void tearDown() { + server.stop(); + if (grpcChannel != null) { + grpcChannel.shutdownNow(); + } + if (grpcServer != null) { + grpcServer.shutdownNow(); + } + } + + // ========== JSON-RPC Transport Tests ========== + + @Test + public void testJsonRpcNonStreamingUnauthenticated() throws A2AClientException { + // Mock server to return 401 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(401) + ); + + Client client = getJSONRPCClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testJsonRpcNonStreamingUnauthorized() throws A2AClientException { + // Mock server to return 403 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(403) + ); + + Client client = getJSONRPCClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testJsonRpcStreamingUnauthenticated() throws Exception { + // Mock server to return 401 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(401) + ); + + assertStreamingError( + getJSONRPCClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testJsonRpcStreamingUnauthorized() throws Exception { + // Mock server to return 403 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/") + ).respond( + response() + .withStatusCode(403) + ); + + assertStreamingError( + getJSONRPCClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + // ========== REST Transport Tests ========== + + @Test + public void testRestNonStreamingUnauthenticated() throws A2AClientException { + // Mock server to return 401 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + ).respond( + response() + .withStatusCode(401) + ); + + Client client = getRestClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testRestNonStreamingUnauthorized() throws A2AClientException { + // Mock server to return 403 for non-streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + ).respond( + response() + .withStatusCode(403) + ); + + Client client = getRestClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testRestStreamingUnauthenticated() throws Exception { + // Mock server to return 401 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + ).respond( + response() + .withStatusCode(401) + ); + + assertStreamingError( + getRestClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testRestStreamingUnauthorized() throws Exception { + // Mock server to return 403 for streaming message + server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + ).respond( + response() + .withStatusCode(403) + ); + + assertStreamingError( + getRestClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + // ========== gRPC Transport Tests ========== + + @Test + public void testGrpcNonStreamingUnauthenticated() throws Exception { + setupGrpcServer(Status.UNAUTHENTICATED); + + Client client = getGrpcClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHENTICATION_FAILED_MESSAGE)); + } + + @Test + public void testGrpcNonStreamingUnauthorized() throws Exception { + setupGrpcServer(Status.PERMISSION_DENIED); + + Client client = getGrpcClientBuilder(false).build(); + + A2AClientException exception = assertThrows(A2AClientException.class, () -> { + client.sendMessage(MESSAGE); + }); + + assertTrue(exception.getMessage().contains(AUTHORIZATION_FAILED_MESSAGE)); + } + + @Test + public void testGrpcStreamingUnauthenticated() throws Exception { + setupGrpcServer(Status.UNAUTHENTICATED); + + assertStreamingError( + getGrpcClientBuilder(true), + AUTHENTICATION_FAILED_MESSAGE); + } + + @Test + public void testGrpcStreamingUnauthorized() throws Exception { + setupGrpcServer(Status.PERMISSION_DENIED); + + assertStreamingError( + getGrpcClientBuilder(true), + AUTHORIZATION_FAILED_MESSAGE); + } + + private ClientBuilder getJSONRPCClientBuilder(boolean streaming) { + return Client.builder(agentCard) + .clientConfig(new ClientConfig.Builder().setStreaming(streaming).build()) + .withTransport(JSONRPCTransport.class, new JSONRPCTransportConfigBuilder()); + } + + private ClientBuilder getRestClientBuilder(boolean streaming) { + return Client.builder(agentCard) + .clientConfig(new ClientConfig.Builder().setStreaming(streaming).build()) + .withTransport(RestTransport.class, new RestTransportConfigBuilder()); + } + + private ClientBuilder getGrpcClientBuilder(boolean streaming) { + return Client.builder(agentCard) + .clientConfig(new ClientConfig.Builder().setStreaming(streaming).build()) + .withTransport(GrpcTransport.class, new GrpcTransportConfigBuilder() + .channelFactory(target -> grpcChannel)); + } + + private void assertStreamingError(ClientBuilder clientBuilder, String expectedErrorMessage) throws Exception { + AtomicReference errorRef = new AtomicReference<>(); + CountDownLatch errorLatch = new CountDownLatch(1); + + Consumer errorHandler = error -> { + errorRef.set(error); + errorLatch.countDown(); + }; + + Client client = clientBuilder.streamingErrorHandler(errorHandler).build(); + + try { + client.sendMessage(MESSAGE); + // If no immediate exception, wait for async error + assertTrue(errorLatch.await(5, TimeUnit.SECONDS), "Expected error handler to be called"); + Throwable error = errorRef.get(); + assertTrue(error.getMessage().contains(expectedErrorMessage), + "Expected error message to contain '" + expectedErrorMessage + "' but got: " + error.getMessage()); + } catch (Exception e) { + // Immediate exception is also acceptable + assertTrue(e.getMessage().contains(expectedErrorMessage), + "Expected error message to contain '" + expectedErrorMessage + "' but got: " + e.getMessage()); + } + } + + private void setupGrpcServer(Status status) throws IOException { + grpcServerName = InProcessServerBuilder.generateName(); + grpcServer = InProcessServerBuilder.forName(grpcServerName) + .directExecutor() + .addService(new A2AServiceGrpc.A2AServiceImplBase() { + @Override + public void sendMessage(SendMessageRequest request, StreamObserver responseObserver) { + responseObserver.onError(status.asRuntimeException()); + } + + @Override + public void sendStreamingMessage(SendMessageRequest request, StreamObserver responseObserver) { + responseObserver.onError(status.asRuntimeException()); + } + }) + .build() + .start(); + + grpcChannel = InProcessChannelBuilder.forName(grpcServerName) + .directExecutor() + .build(); + } +} \ No newline at end of file diff --git a/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilderTest.java b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilderTest.java new file mode 100644 index 000000000..71cec5f9b --- /dev/null +++ b/compat-0.3/client/base/src/test/java/org/a2aproject/sdk/compat03/client/ClientBuilderTest.java @@ -0,0 +1,96 @@ +package org.a2aproject.sdk.compat03.client; + +import org.a2aproject.sdk.compat03.client.config.ClientConfig; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransport; +import org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportConfigBuilder; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransport; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfig; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportConfigBuilder; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Collections; +import java.util.List; + +public class ClientBuilderTest { + + private AgentCard card = new AgentCard.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(List.of( + new AgentInterface(TransportProtocol.JSONRPC.asString(), "http://localhost:9999"))) + .build(); + + @Test + public void shouldNotFindCompatibleTransport() throws A2AClientException { + A2AClientException exception = Assertions.assertThrows(A2AClientException.class, + () -> Client + .builder(card) + .clientConfig(new ClientConfig.Builder().setUseClientPreference(true).build()) + .withTransport(GrpcTransport.class, new GrpcTransportConfigBuilder() + .channelFactory(s -> null)) + .build()); + + Assertions.assertTrue(exception.getMessage() != null && exception.getMessage().contains("No compatible transport found")); + } + + @Test + public void shouldNotFindConfigurationTransport() throws A2AClientException { + A2AClientException exception = Assertions.assertThrows(A2AClientException.class, + () -> Client + .builder(card) + .clientConfig(new ClientConfig.Builder().setUseClientPreference(true).build()) + .build()); + + Assertions.assertTrue(exception.getMessage() != null && exception.getMessage().startsWith("Missing required TransportConfig for")); + } + + @Test + public void shouldCreateJSONRPCClient() throws A2AClientException { + Client client = Client + .builder(card) + .clientConfig(new ClientConfig.Builder().setUseClientPreference(true).build()) + .withTransport(JSONRPCTransport.class, new JSONRPCTransportConfigBuilder() + .addInterceptor(null) + .httpClient(null)) + .build(); + + Assertions.assertNotNull(client); + } + + @Test + public void shouldCreateClient_differentConfigurations() throws A2AClientException { + Client client = Client + .builder(card) + .withTransport(JSONRPCTransport.class, new JSONRPCTransportConfigBuilder()) + .withTransport(JSONRPCTransport.class, new JSONRPCTransportConfig(new JdkA2AHttpClient())) + .build(); + + Assertions.assertNotNull(client); + } +} diff --git a/compat-0.3/client/transport/grpc/pom.xml b/compat-0.3/client/transport/grpc/pom.xml new file mode 100644 index 000000000..e0ca84574 --- /dev/null +++ b/compat-0.3/client/transport/grpc/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-grpc + jar + + Java SDK A2A Compat 0.3 Client Transport: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - gRPC Client Transport + + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver.java new file mode 100644 index 000000000..f9ff2e1b9 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/EventStreamObserver.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + + +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import io.grpc.stub.StreamObserver; + +import java.util.function.Consumer; +import java.util.logging.Logger; + +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils.FromProto; + +public class EventStreamObserver implements StreamObserver { + + private static final Logger log = Logger.getLogger(EventStreamObserver.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + + public EventStreamObserver(Consumer eventHandler, Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + @Override + public void onNext(StreamResponse response) { + StreamingEventKind event; + switch (response.getPayloadCase()) { + case MSG: + event = FromProto.message(response.getMsg()); + break; + case TASK: + event = FromProto.task(response.getTask()); + break; + case STATUS_UPDATE: + event = FromProto.taskStatusUpdateEvent(response.getStatusUpdate()); + break; + case ARTIFACT_UPDATE: + event = FromProto.taskArtifactUpdateEvent(response.getArtifactUpdate()); + break; + default: + log.warning("Invalid stream response " + response.getPayloadCase()); + errorHandler.accept(new IllegalStateException("Invalid stream response from server: " + response.getPayloadCase())); + return; + } + eventHandler.accept(event); + } + + @Override + public void onError(Throwable t) { + if (errorHandler != null) { + // Map gRPC errors to proper A2A exceptions + if (t instanceof io.grpc.StatusRuntimeException) { + errorHandler.accept(GrpcErrorMapper.mapGrpcError((io.grpc.StatusRuntimeException) t)); + } else { + errorHandler.accept(t); + } + } + } + + @Override + public void onCompleted() { + // done + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper.java new file mode 100644 index 000000000..ab9e6de18 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapper.java @@ -0,0 +1,101 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.common.A2AErrorMessages; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import io.grpc.Status; +import io.grpc.StatusException; +import io.grpc.StatusRuntimeException; + +/** + * Utility class to map gRPC StatusRuntimeException to appropriate A2A error types + */ +public class GrpcErrorMapper { + + // Overload for StatusRuntimeException (original 0.3.x signature) + public static A2AClientException mapGrpcError(StatusRuntimeException e) { + return mapGrpcError(e, "gRPC error: "); + } + + public static A2AClientException mapGrpcError(StatusRuntimeException e, String errorPrefix) { + return mapGrpcErrorInternal(e.getStatus().getCode(), e.getStatus().getDescription(), e, errorPrefix); + } + + // Overload for StatusException (gRPC 1.77+ compatibility) + public static A2AClientException mapGrpcError(StatusException e) { + return mapGrpcError(e, "gRPC error: "); + } + + public static A2AClientException mapGrpcError(StatusException e, String errorPrefix) { + return mapGrpcErrorInternal(e.getStatus().getCode(), e.getStatus().getDescription(), e, errorPrefix); + } + + // Dispatcher for multi-catch (StatusRuntimeException | StatusException) + public static A2AClientException mapGrpcError(Exception e, String errorPrefix) { + if (e instanceof StatusRuntimeException) { + return mapGrpcError((StatusRuntimeException) e, errorPrefix); + } else if (e instanceof StatusException) { + return mapGrpcError((StatusException) e, errorPrefix); + } else { + return new A2AClientException(errorPrefix + e.getMessage(), e); + } + } + + private static A2AClientException mapGrpcErrorInternal(Status.Code code, @org.jspecify.annotations.Nullable String description, @org.jspecify.annotations.Nullable Throwable cause, String errorPrefix) { + + // Extract the actual error type from the description if possible + // (using description because the same code can map to multiple errors - + // see GrpcHandler#handleError) + if (description != null) { + if (description.contains("TaskNotFoundError")) { + return new A2AClientException(errorPrefix + description, new TaskNotFoundError()); + } else if (description.contains("UnsupportedOperationError")) { + return new A2AClientException(errorPrefix + description, new UnsupportedOperationError()); + } else if (description.contains("InvalidParamsError")) { + return new A2AClientException(errorPrefix + description, new InvalidParamsError()); + } else if (description.contains("InvalidRequestError")) { + return new A2AClientException(errorPrefix + description, new InvalidRequestError()); + } else if (description.contains("MethodNotFoundError")) { + return new A2AClientException(errorPrefix + description, new MethodNotFoundError()); + } else if (description.contains("TaskNotCancelableError")) { + return new A2AClientException(errorPrefix + description, new TaskNotCancelableError()); + } else if (description.contains("PushNotificationNotSupportedError")) { + return new A2AClientException(errorPrefix + description, new PushNotificationNotSupportedError()); + } else if (description.contains("JSONParseError")) { + return new A2AClientException(errorPrefix + description, new JSONParseError()); + } else if (description.contains("ContentTypeNotSupportedError")) { + return new A2AClientException(errorPrefix + description, new ContentTypeNotSupportedError(null, description, null)); + } else if (description.contains("InvalidAgentResponseError")) { + return new A2AClientException(errorPrefix + description, new InvalidAgentResponseError(null, description, null)); + } + } + + // Fall back to mapping based on status code + String message = description != null ? description : (cause != null ? cause.getMessage() : "Unknown error"); + switch (code) { + case NOT_FOUND: + return new A2AClientException(errorPrefix + message, new TaskNotFoundError()); + case UNIMPLEMENTED: + return new A2AClientException(errorPrefix + message, new UnsupportedOperationError()); + case INVALID_ARGUMENT: + return new A2AClientException(errorPrefix + message, new InvalidParamsError()); + case INTERNAL: + return new A2AClientException(errorPrefix + message, new org.a2aproject.sdk.compat03.spec.InternalError(null, message, null)); + case UNAUTHENTICATED: + return new A2AClientException(errorPrefix + A2AErrorMessages.AUTHENTICATION_FAILED); + case PERMISSION_DENIED: + return new A2AClientException(errorPrefix + A2AErrorMessages.AUTHORIZATION_FAILED); + default: + return new A2AClientException(errorPrefix + message, cause); + } + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport.java new file mode 100644 index 000000000..bb0de3eca --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransport.java @@ -0,0 +1,384 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth.AuthInterceptor; +import org.a2aproject.sdk.common.A2AHeaders; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceBlockingV2Stub; +import org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceStub; +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils.FromProto; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils.ToProto; +import io.grpc.StatusException; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import io.grpc.Channel; +import io.grpc.Metadata; +import io.grpc.StatusRuntimeException; +import io.grpc.stub.MetadataUtils; +import io.grpc.stub.StreamObserver; +import org.jspecify.annotations.Nullable; + +public class GrpcTransport implements ClientTransport { + + private static final Metadata.Key AUTHORIZATION_METADATA_KEY = Metadata.Key.of( + AuthInterceptor.AUTHORIZATION, + Metadata.ASCII_STRING_MARSHALLER); + private static final Metadata.Key EXTENSIONS_KEY = Metadata.Key.of( + "X-A2A-Extensions", + Metadata.ASCII_STRING_MARSHALLER); + private final A2AServiceBlockingV2Stub blockingStub; + private final A2AServiceStub asyncStub; + private final @Nullable List interceptors; + private AgentCard agentCard; + + public GrpcTransport(Channel channel, AgentCard agentCard) { + this(channel, agentCard, null); + } + + public GrpcTransport(Channel channel, AgentCard agentCard, @Nullable List interceptors) { + checkNotNullParam("channel", channel); + checkNotNullParam("agentCard", agentCard); + this.asyncStub = A2AServiceGrpc.newStub(channel); + this.blockingStub = A2AServiceGrpc.newBlockingV2Stub(channel); + this.agentCard = agentCard; + this.interceptors = interceptors; + } + + @Override + public EventKind sendMessage(MessageSendParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + SendMessageRequest sendMessageRequest = createGrpcSendMessageRequest(request, context); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.SendMessageRequest.METHOD, sendMessageRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + SendMessageResponse response = stubWithMetadata.sendMessage(sendMessageRequest); + if (response.hasMsg()) { + return FromProto.message(response.getMsg()); + } else if (response.hasTask()) { + return FromProto.task(response.getTask()); + } else { + throw new A2AClientException("Server response did not contain a message or task"); + } + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to send message: "); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + SendMessageRequest grpcRequest = createGrpcSendMessageRequest(request, context); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest.METHOD, + grpcRequest, agentCard, context); + StreamObserver streamObserver = new EventStreamObserver(eventConsumer, errorConsumer); + + try { + A2AServiceStub stubWithMetadata = createAsyncStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.sendStreamingMessage(grpcRequest, streamObserver); + } catch (StatusRuntimeException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to send streaming message request: "); + } + } + + @Override + public Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + GetTaskRequest.Builder requestBuilder = GetTaskRequest.newBuilder(); + requestBuilder.setName("tasks/" + request.id()); + requestBuilder.setHistoryLength(request.historyLength()); + GetTaskRequest getTaskRequest = requestBuilder.build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.GetTaskRequest.METHOD, getTaskRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.task(stubWithMetadata.getTask(getTaskRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to get task: "); + } + } + + @Override + public Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + CancelTaskRequest cancelTaskRequest = CancelTaskRequest.newBuilder() + .setName("tasks/" + request.id()) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.CancelTaskRequest.METHOD, cancelTaskRequest, + agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.task(stubWithMetadata.cancelTask(cancelTaskRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to cancel task: "); + } + } + + @Override + public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, + @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + String configId = request.pushNotificationConfig().id(); + CreateTaskPushNotificationConfigRequest grpcRequest = CreateTaskPushNotificationConfigRequest.newBuilder() + .setParent("tasks/" + request.taskId()) + .setConfig(ToProto.taskPushNotificationConfig(request)) + .setConfigId(configId != null ? configId : request.taskId()) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.taskPushNotificationConfig(stubWithMetadata.createTaskPushNotificationConfig(grpcRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to create task push notification config: "); + } + } + + @Override + public TaskPushNotificationConfig getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + GetTaskPushNotificationConfigRequest grpcRequest = GetTaskPushNotificationConfigRequest.newBuilder() + .setName(getTaskPushNotificationConfigName(request)) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return FromProto.taskPushNotificationConfig(stubWithMetadata.getTaskPushNotificationConfig(grpcRequest)); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to get task push notification config: "); + } + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + ListTaskPushNotificationConfigRequest grpcRequest = ListTaskPushNotificationConfigRequest.newBuilder() + .setParent("tasks/" + request.id()) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + return stubWithMetadata.listTaskPushNotificationConfig(grpcRequest).getConfigsList().stream() + .map(FromProto::taskPushNotificationConfig) + .collect(Collectors.toList()); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to list task push notification config: "); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + + DeleteTaskPushNotificationConfigRequest grpcRequest = DeleteTaskPushNotificationConfigRequest.newBuilder() + .setName(getTaskPushNotificationConfigName(request.id(), request.pushNotificationConfigId())) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest.METHOD, + grpcRequest, agentCard, context); + + try { + A2AServiceBlockingV2Stub stubWithMetadata = createBlockingStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.deleteTaskPushNotificationConfig(grpcRequest); + } catch (StatusRuntimeException | StatusException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to delete task push notification config: "); + } + } + + @Override + public void resubscribe(TaskIdParams request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + + TaskSubscriptionRequest grpcRequest = TaskSubscriptionRequest.newBuilder() + .setName("tasks/" + request.id()) + .build(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest.METHOD, + grpcRequest, agentCard, context); + + StreamObserver streamObserver = new EventStreamObserver(eventConsumer, errorConsumer); + + try { + A2AServiceStub stubWithMetadata = createAsyncStubWithMetadata(context, payloadAndHeaders); + stubWithMetadata.taskSubscription(grpcRequest, streamObserver); + } catch (StatusRuntimeException e) { + throw GrpcErrorMapper.mapGrpcError(e, "Failed to resubscribe task push notification config: "); + } + } + + @Override + public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException { + // TODO: Determine how to handle retrieving the authenticated extended agent card + return agentCard; + } + + @Override + public void close() { + } + + private SendMessageRequest createGrpcSendMessageRequest(MessageSendParams messageSendParams, @Nullable ClientCallContext context) { + SendMessageRequest.Builder builder = SendMessageRequest.newBuilder(); + builder.setRequest(ToProto.message(messageSendParams.message())); + if (messageSendParams.configuration() != null) { + builder.setConfiguration(ToProto.messageSendConfiguration(messageSendParams.configuration())); + } + if (messageSendParams.metadata() != null) { + builder.setMetadata(ToProto.struct(messageSendParams.metadata())); + } + return builder.build(); + } + + /** + * Creates gRPC metadata from ClientCallContext headers. + * Extracts headers like X-A2A-Extensions and sets them as gRPC metadata. + * @param context the client call context containing headers, may be null + * @param payloadAndHeaders the payload and headers wrapper, may be null + * @return the gRPC metadata + */ + private Metadata createGrpcMetadata(@Nullable ClientCallContext context, @Nullable PayloadAndHeaders payloadAndHeaders) { + Metadata metadata = new Metadata(); + + if (context != null && context.getHeaders() != null) { + // Set X-A2A-Extensions header if present + String extensionsHeader = context.getHeaders().get("X-A2A-Extensions"); + if (extensionsHeader != null) { + metadata.put(EXTENSIONS_KEY, extensionsHeader); + } + + // Add other headers as needed in the future + // For now, we only handle X-A2A-Extensions + } + if (payloadAndHeaders != null && payloadAndHeaders.getHeaders() != null) { + // Handle all headers from interceptors (including auth headers) + for (Map.Entry headerEntry : payloadAndHeaders.getHeaders().entrySet()) { + String headerName = headerEntry.getKey(); + String headerValue = headerEntry.getValue(); + + if (headerValue != null) { + // Use static key for common Authorization header, create dynamic keys for others + if (AuthInterceptor.AUTHORIZATION.equals(headerName)) { + metadata.put(AUTHORIZATION_METADATA_KEY, headerValue); + } else { + // Create a metadata key dynamically for API keys and other custom headers + Metadata.Key metadataKey = Metadata.Key.of(headerName, Metadata.ASCII_STRING_MARSHALLER); + metadata.put(metadataKey, headerValue); + } + } + } + } + + return metadata; + } + + /** + * Creates a blocking stub with metadata attached from the ClientCallContext. + * + * @param context the client call context + * @param payloadAndHeaders the payloadAndHeaders after applying any interceptors + * @return blocking stub with metadata interceptor + */ + private A2AServiceBlockingV2Stub createBlockingStubWithMetadata(@Nullable ClientCallContext context, + PayloadAndHeaders payloadAndHeaders) { + Metadata metadata = createGrpcMetadata(context, payloadAndHeaders); + return blockingStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata)); + } + + /** + * Creates an async stub with metadata attached from the ClientCallContext. + * + * @param context the client call context + * @param payloadAndHeaders the payloadAndHeaders after applying any interceptors + * @return async stub with metadata interceptor + */ + private A2AServiceStub createAsyncStubWithMetadata(@Nullable ClientCallContext context, + PayloadAndHeaders payloadAndHeaders) { + Metadata metadata = createGrpcMetadata(context, payloadAndHeaders); + return asyncStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata)); + } + + private String getTaskPushNotificationConfigName(GetTaskPushNotificationConfigParams params) { + return getTaskPushNotificationConfigName(params.id(), params.pushNotificationConfigId()); + } + + private String getTaskPushNotificationConfigName(String taskId, @Nullable String pushNotificationConfigId) { + StringBuilder name = new StringBuilder(); + name.append("tasks/"); + name.append(taskId); + if (pushNotificationConfigId != null) { + name.append("/pushNotificationConfigs/"); + name.append(pushNotificationConfigId); + } + //name.append("/pushNotificationConfigs/"); + // Use taskId as default config ID if none provided + //name.append(pushNotificationConfigId != null ? pushNotificationConfigId : taskId); + return name.toString(); + } + + private PayloadAndHeaders applyInterceptors(String methodName, Object payload, + AgentCard agentCard, @Nullable ClientCallContext clientCallContext) { + PayloadAndHeaders payloadAndHeaders = new PayloadAndHeaders(payload, + clientCallContext != null ? clientCallContext.getHeaders() : null); + if (interceptors != null && ! interceptors.isEmpty()) { + for (ClientCallInterceptor interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig.java new file mode 100644 index 000000000..cb50e1fbf --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfig.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig; +import org.a2aproject.sdk.util.Assert; +import io.grpc.Channel; + +import java.util.function.Function; + +public class GrpcTransportConfig extends ClientTransportConfig { + + private final Function channelFactory; + + public GrpcTransportConfig(Function channelFactory) { + Assert.checkNotNullParam("channelFactory", channelFactory); + this.channelFactory = channelFactory; + } + + public Function getChannelFactory() { + return this.channelFactory; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder.java new file mode 100644 index 000000000..4ec282d4c --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportConfigBuilder.java @@ -0,0 +1,32 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder; +import org.a2aproject.sdk.util.Assert; +import io.grpc.Channel; + +import java.util.function.Function; + +import org.jspecify.annotations.Nullable; + +public class GrpcTransportConfigBuilder extends ClientTransportConfigBuilder { + + private @Nullable Function channelFactory; + + public GrpcTransportConfigBuilder channelFactory(Function channelFactory) { + Assert.checkNotNullParam("channelFactory", channelFactory); + + this.channelFactory = channelFactory; + + return this; + } + + @Override + public GrpcTransportConfig build() { + if (channelFactory == null) { + throw new IllegalStateException("channelFactory must be set"); + } + GrpcTransportConfig config = new GrpcTransportConfig(channelFactory); + config.setInterceptors(interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider.java new file mode 100644 index 000000000..ce4d79c4c --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcTransportProvider.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; +import io.grpc.Channel; + +/** + * Provider for gRPC transport implementation. + */ +public class GrpcTransportProvider implements ClientTransportProvider { + + @Override + public GrpcTransport create(GrpcTransportConfig grpcTransportConfig, AgentCard agentCard, String agentUrl) throws A2AClientException { + // not making use of the interceptors for gRPC for now + + Channel channel = grpcTransportConfig.getChannelFactory().apply(agentUrl); + if (channel != null) { + return new GrpcTransport(channel, agentCard, grpcTransportConfig.getInterceptors()); + } + + throw new A2AClientException("Missing required GrpcTransportConfig"); + } + + @Override + public String getTransportProtocol() { + return TransportProtocol.GRPC.asString(); + } + + @Override + public Class getTransportProtocolClass() { + return GrpcTransport.class; + } +} diff --git a/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java new file mode 100644 index 000000000..71bb5c883 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/grpc/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import org.jspecify.annotations.NullMarked; \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider b/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider new file mode 100644 index 000000000..021357f18 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.grpc.GrpcTransportProvider \ No newline at end of file diff --git a/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapperTest.java b/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapperTest.java new file mode 100644 index 000000000..4bc2659a9 --- /dev/null +++ b/compat-0.3/client/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/grpc/GrpcErrorMapperTest.java @@ -0,0 +1,293 @@ +package org.a2aproject.sdk.compat03.client.transport.grpc; + +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import org.junit.jupiter.api.Test; + +/** + * Tests for GrpcErrorMapper - verifies correct mapping of gRPC StatusRuntimeException + * to v0.3 A2A error types based on description string matching and status codes. + */ +public class GrpcErrorMapperTest { + + @Test + public void testTaskNotFoundErrorByDescription() { + String errorMessage = "TaskNotFoundError: Task task-123 not found"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError.class, result.getCause()); + assertTrue(result.getMessage().contains(errorMessage)); + } + + @Test + public void testTaskNotFoundErrorByStatusCode() { + // Test fallback to status code mapping when description doesn't contain error type + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription("Generic not found error") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError.class, result.getCause()); + } + + @Test + public void testUnsupportedOperationErrorByDescription() { + String errorMessage = "UnsupportedOperationError: Operation not supported"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(UnsupportedOperationError.class, result.getCause()); + } + + @Test + public void testUnsupportedOperationErrorByStatusCode() { + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription("Generic unimplemented error") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(UnsupportedOperationError.class, result.getCause()); + } + + @Test + public void testInvalidParamsErrorByDescription() { + String errorMessage = "InvalidParamsError: Invalid parameters provided"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidParamsError.class, result.getCause()); + } + + @Test + public void testInvalidParamsErrorByStatusCode() { + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription("Generic invalid argument") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidParamsError.class, result.getCause()); + } + + @Test + public void testInvalidRequestError() { + String errorMessage = "InvalidRequestError: Request is malformed"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidRequestError.class, result.getCause()); + } + + @Test + public void testMethodNotFoundError() { + String errorMessage = "MethodNotFoundError: Method does not exist"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(MethodNotFoundError.class, result.getCause()); + } + + @Test + public void testTaskNotCancelableError() { + String errorMessage = "TaskNotCancelableError: Task cannot be cancelled"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotCancelableError.class, result.getCause()); + } + + @Test + public void testPushNotificationNotSupportedError() { + String errorMessage = "PushNotificationNotSupportedError: Push notifications not supported"; + StatusRuntimeException grpcException = Status.UNIMPLEMENTED + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(PushNotificationNotSupportedError.class, result.getCause()); + } + + @Test + public void testJSONParseError() { + String errorMessage = "JSONParseError: Failed to parse JSON"; + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(JSONParseError.class, result.getCause()); + } + + @Test + public void testContentTypeNotSupportedError() { + String errorMessage = "ContentTypeNotSupportedError: Content type application/xml not supported"; + StatusRuntimeException grpcException = Status.INVALID_ARGUMENT + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(ContentTypeNotSupportedError.class, result.getCause()); + + ContentTypeNotSupportedError contentTypeError = (ContentTypeNotSupportedError) result.getCause(); + assertNotNull(contentTypeError.getMessage()); + assertTrue(contentTypeError.getMessage().contains("Content type application/xml not supported")); + } + + @Test + public void testInvalidAgentResponseError() { + String errorMessage = "InvalidAgentResponseError: Agent response is invalid"; + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription(errorMessage) + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InvalidAgentResponseError.class, result.getCause()); + + InvalidAgentResponseError agentResponseError = (InvalidAgentResponseError) result.getCause(); + assertNotNull(agentResponseError.getMessage()); + assertTrue(agentResponseError.getMessage().contains("Agent response is invalid")); + } + + @Test + public void testInternalErrorByStatusCode() { + StatusRuntimeException grpcException = Status.INTERNAL + .withDescription("Internal server error") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(InternalError.class, result.getCause()); + } + + @Test + public void testCustomErrorPrefix() { + String errorMessage = "TaskNotFoundError: Task not found"; + StatusRuntimeException grpcException = Status.NOT_FOUND + .withDescription(errorMessage) + .asRuntimeException(); + + String customPrefix = "Custom Error: "; + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException, customPrefix); + + assertNotNull(result); + assertTrue(result.getMessage().startsWith(customPrefix)); + assertInstanceOf(TaskNotFoundError.class, result.getCause()); + } + + @Test + public void testAuthenticationFailed() { + StatusRuntimeException grpcException = Status.UNAUTHENTICATED + .withDescription("Authentication failed") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Authentication failed")); + } + + @Test + public void testAuthorizationFailed() { + StatusRuntimeException grpcException = Status.PERMISSION_DENIED + .withDescription("Permission denied") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Authorization failed")); + } + + @Test + public void testUnknownStatusCode() { + StatusRuntimeException grpcException = Status.DEADLINE_EXCEEDED + .withDescription("Request timeout") + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertTrue(result.getMessage().contains("Request timeout")); + } + + @Test + public void testNullDescription() { + StatusRuntimeException grpcException = Status.NOT_FOUND + .asRuntimeException(); + + A2AClientException result = GrpcErrorMapper.mapGrpcError(grpcException); + + assertNotNull(result); + assertNotNull(result.getCause()); + assertInstanceOf(TaskNotFoundError.class, result.getCause()); + } +} diff --git a/compat-0.3/client/transport/jsonrpc/pom.xml b/compat-0.3/client/transport/jsonrpc/pom.xml new file mode 100644 index 000000000..83f0ac416 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + jar + + Java SDK A2A Compat 0.3 Client Transport: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - JSONRPC Client Transport + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport.java new file mode 100644 index 000000000..1090112c4 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransport.java @@ -0,0 +1,424 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; + +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse; + +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.JSONRPCMessage; +import org.a2aproject.sdk.compat03.spec.JSONRPCResponse; + +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse.SSEEventListener; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; + +public class JSONRPCTransport implements ClientTransport { + + private static final Class SEND_MESSAGE_RESPONSE_REFERENCE = SendMessageResponse.class; + private static final Class GET_TASK_RESPONSE_REFERENCE = GetTaskResponse.class; + private static final Class CANCEL_TASK_RESPONSE_REFERENCE = CancelTaskResponse.class; + private static final Class GET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = GetTaskPushNotificationConfigResponse.class; + private static final Class SET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = SetTaskPushNotificationConfigResponse.class; + private static final Class LIST_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = ListTaskPushNotificationConfigResponse.class; + private static final Class DELETE_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE = DeleteTaskPushNotificationConfigResponse.class; + private static final Class GET_AUTHENTICATED_EXTENDED_CARD_RESPONSE_REFERENCE = GetAuthenticatedExtendedCardResponse.class; + + private final A2AHttpClient httpClient; + private final String agentUrl; + private final List interceptors; + private AgentCard agentCard; + private boolean needsExtendedCard = false; + + public JSONRPCTransport(String agentUrl) { + this(null, null, agentUrl, null); + } + + public JSONRPCTransport(AgentCard agentCard) { + this(null, agentCard, agentCard.url(), null); + } + + public JSONRPCTransport(A2AHttpClient httpClient, AgentCard agentCard, + String agentUrl, List interceptors) { + this.httpClient = httpClient == null ? new JdkA2AHttpClient() : httpClient; + this.agentCard = agentCard; + this.agentUrl = agentUrl; + this.interceptors = interceptors; + this.needsExtendedCard = agentCard == null || agentCard.supportsAuthenticatedExtendedCard(); + } + + @Override + public EventKind sendMessage(MessageSendParams request, ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + SendMessageRequest sendMessageRequest = new SendMessageRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(SendMessageRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SendMessageRequest.METHOD, sendMessageRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + SendMessageResponse response = unmarshalResponse(httpResponseBody, SEND_MESSAGE_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to send message: " + e, e); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams request, Consumer eventConsumer, + Consumer errorConsumer, ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + SendStreamingMessageRequest sendStreamingMessageRequest = new SendStreamingMessageRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(SendStreamingMessageRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest.METHOD, + sendStreamingMessageRequest, agentCard, context); + + AtomicReference> ref = new AtomicReference<>(); + SSEEventListener sseEventListener = new SSEEventListener(eventConsumer, errorConsumer); + + try { + A2AHttpClient.PostBuilder builder = createPostBuilder(payloadAndHeaders); + ref.set(builder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // Signal normal stream completion to error handler (null error means success) + sseEventListener.onComplete(); + })); + } catch (IOException e) { + throw new A2AClientException("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException e) { + throw new A2AClientException("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public Task getTask(TaskQueryParams request, ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + GetTaskRequest getTaskRequest = new GetTaskRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(GetTaskRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(GetTaskRequest.METHOD, getTaskRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetTaskResponse response = unmarshalResponse(httpResponseBody, GET_TASK_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to get task: " + e, e); + } + } + + @Override + public Task cancelTask(TaskIdParams request, ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + CancelTaskRequest cancelTaskRequest = new CancelTaskRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(CancelTaskRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(CancelTaskRequest.METHOD, cancelTaskRequest, + agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + CancelTaskResponse response = unmarshalResponse(httpResponseBody, CANCEL_TASK_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to cancel task: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, + ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + SetTaskPushNotificationConfigRequest setTaskPushNotificationRequest = new SetTaskPushNotificationConfigRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(SetTaskPushNotificationConfigRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest.METHOD, + setTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + SetTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, + SET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to set task push notification config: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams request, + ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + GetTaskPushNotificationConfigRequest getTaskPushNotificationRequest = new GetTaskPushNotificationConfigRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(GetTaskPushNotificationConfigRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(GetTaskPushNotificationConfigRequest.METHOD, + getTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, + GET_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to get task push notification config: " + e, e); + } + } + + @Override + public List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request, + ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + ListTaskPushNotificationConfigRequest listTaskPushNotificationRequest = new ListTaskPushNotificationConfigRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(ListTaskPushNotificationConfigRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(ListTaskPushNotificationConfigRequest.METHOD, + listTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + ListTaskPushNotificationConfigResponse response = unmarshalResponse(httpResponseBody, + LIST_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + return response.getResult(); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to list task push notification configs: " + e, e); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, + ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + DeleteTaskPushNotificationConfigRequest deleteTaskPushNotificationRequest = new DeleteTaskPushNotificationConfigRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(DeleteTaskPushNotificationConfigRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(DeleteTaskPushNotificationConfigRequest.METHOD, + deleteTaskPushNotificationRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + unmarshalResponse(httpResponseBody, DELETE_TASK_PUSH_NOTIFICATION_CONFIG_RESPONSE_REFERENCE); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to delete task push notification configs: " + e, e); + } + } + + @Override + public void resubscribe(TaskIdParams request, Consumer eventConsumer, + Consumer errorConsumer, ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + checkNotNullParam("eventConsumer", eventConsumer); + checkNotNullParam("errorConsumer", errorConsumer); + TaskResubscriptionRequest taskResubscriptionRequest = new TaskResubscriptionRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(TaskResubscriptionRequest.METHOD) + .params(request) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(TaskResubscriptionRequest.METHOD, + taskResubscriptionRequest, agentCard, context); + + AtomicReference> ref = new AtomicReference<>(); + SSEEventListener sseEventListener = new SSEEventListener(eventConsumer, errorConsumer); + + try { + A2AHttpClient.PostBuilder builder = createPostBuilder(payloadAndHeaders); + ref.set(builder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // Signal normal stream completion to error handler (null error means success) + sseEventListener.onComplete(); + })); + } catch (IOException e) { + throw new A2AClientException("Failed to send task resubscription request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException("Task resubscription request timed out: " + e, e); + } catch (JsonProcessingException e) { + throw new A2AClientException("Failed to process JSON for task resubscription request: " + e, e); + } + } + + @Override + public AgentCard getAgentCard(ClientCallContext context) throws A2AClientException { + A2ACardResolver resolver; + try { + if (agentCard == null) { + resolver = new A2ACardResolver(httpClient, agentUrl, null, getHttpHeaders(context)); + agentCard = resolver.getAgentCard(); + needsExtendedCard = agentCard.supportsAuthenticatedExtendedCard(); + } + if (!needsExtendedCard) { + return agentCard; + } + + GetAuthenticatedExtendedCardRequest getExtendedAgentCardRequest = new GetAuthenticatedExtendedCardRequest.Builder() + .jsonrpc(JSONRPCMessage.JSONRPC_VERSION) + .method(GetAuthenticatedExtendedCardRequest.METHOD) + .build(); // id will be randomly generated + + PayloadAndHeaders payloadAndHeaders = applyInterceptors(GetAuthenticatedExtendedCardRequest.METHOD, + getExtendedAgentCardRequest, agentCard, context); + + try { + String httpResponseBody = sendPostRequest(payloadAndHeaders); + GetAuthenticatedExtendedCardResponse response = unmarshalResponse(httpResponseBody, + GET_AUTHENTICATED_EXTENDED_CARD_RESPONSE_REFERENCE); + agentCard = response.getResult(); + needsExtendedCard = false; + return agentCard; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to get authenticated extended agent card: " + e, e); + } + } catch(A2AClientError e){ + throw new A2AClientException("Failed to get agent card: " + e, e); + } + } + + @Override + public void close() { + // no-op + } + + private PayloadAndHeaders applyInterceptors(String methodName, Object payload, + AgentCard agentCard, ClientCallContext clientCallContext) { + PayloadAndHeaders payloadAndHeaders = new PayloadAndHeaders(payload, getHttpHeaders(clientCallContext)); + if (interceptors != null && ! interceptors.isEmpty()) { + for (ClientCallInterceptor interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + + private String sendPostRequest(PayloadAndHeaders payloadAndHeaders) throws IOException, InterruptedException, JsonProcessingException { + A2AHttpClient.PostBuilder builder = createPostBuilder(payloadAndHeaders); + A2AHttpResponse response = builder.post(); + if (!response.success()) { + throw new IOException("Request failed " + response.status()); + } + return response.body(); + } + + private A2AHttpClient.PostBuilder createPostBuilder(PayloadAndHeaders payloadAndHeaders) throws JsonProcessingException { + A2AHttpClient.PostBuilder postBuilder = httpClient.createPost() + .url(agentUrl) + .addHeader("Content-Type", "application/json") + .body(JsonUtil.toJson(payloadAndHeaders.getPayload())); + + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + postBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + + return postBuilder; + } + + private > T unmarshalResponse(String response, Class responseClass) + throws A2AClientException, JsonProcessingException { + T value = JsonUtil.fromJson(response, responseClass); + JSONRPCError error = value.getError(); + if (error != null) { + throw new A2AClientException(error.getMessage() + (error.getData() != null ? ": " + error.getData() : ""), error); + } + return value; + } + + private Map getHttpHeaders(ClientCallContext context) { + return context != null ? context.getHeaders() : null; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig.java new file mode 100644 index 000000000..85e15deb5 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfig.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; + +public class JSONRPCTransportConfig extends ClientTransportConfig { + + private final A2AHttpClient httpClient; + + public JSONRPCTransportConfig() { + this.httpClient = null; + } + + public JSONRPCTransportConfig(A2AHttpClient httpClient) { + this.httpClient = httpClient; + } + + public A2AHttpClient getHttpClient() { + return httpClient; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder.java new file mode 100644 index 000000000..c602094f7 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportConfigBuilder.java @@ -0,0 +1,28 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder; + +public class JSONRPCTransportConfigBuilder extends ClientTransportConfigBuilder { + + private A2AHttpClient httpClient; + + public JSONRPCTransportConfigBuilder httpClient(A2AHttpClient httpClient) { + this.httpClient = httpClient; + + return this; + } + + @Override + public JSONRPCTransportConfig build() { + // No HTTP client provided, fallback to the default one (JDK-based implementation) + if (httpClient == null) { + httpClient = new JdkA2AHttpClient(); + } + + JSONRPCTransportConfig config = new JSONRPCTransportConfig(httpClient); + config.setInterceptors(this.interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider.java new file mode 100644 index 000000000..5e7eab1f6 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportProvider.java @@ -0,0 +1,29 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +public class JSONRPCTransportProvider implements ClientTransportProvider { + + @Override + public JSONRPCTransport create(JSONRPCTransportConfig clientTransportConfig, AgentCard agentCard, String agentUrl) throws A2AClientException { + if (clientTransportConfig == null) { + clientTransportConfig = new JSONRPCTransportConfig(new JdkA2AHttpClient()); + } + + return new JSONRPCTransport(clientTransportConfig.getHttpClient(), agentCard, agentUrl, clientTransportConfig.getInterceptors()); + } + + @Override + public String getTransportProtocol() { + return TransportProtocol.JSONRPC.asString(); + } + + @Override + public Class getTransportProtocolClass() { + return JSONRPCTransport.class; + } +} diff --git a/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener.java b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener.java new file mode 100644 index 000000000..3e9a9e745 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListener.java @@ -0,0 +1,88 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; + +import java.util.concurrent.Future; +import java.util.function.Consumer; +import java.util.logging.Logger; + +public class SSEEventListener { + private static final Logger log = Logger.getLogger(SSEEventListener.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + private volatile boolean completed = false; + + public SSEEventListener(Consumer eventHandler, + Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + public void onMessage(String message, Future completableFuture) { + try { + handleMessage(JsonParser.parseString(message).getAsJsonObject(), completableFuture); + } catch (JsonSyntaxException e) { + log.warning("Failed to parse JSON message: " + message); + } catch (JsonProcessingException e) { + log.warning("Failed to process JSON message: " + message); + } catch (IllegalArgumentException e) { + log.warning("Invalid message format: " + message); + if (errorHandler != null) { + errorHandler.accept(e); + } + completableFuture.cancel(true); // close SSE channel + } + } + + public void onError(Throwable throwable, Future future) { + if (errorHandler != null) { + errorHandler.accept(throwable); + } + future.cancel(true); // close SSE channel + } + + public void onComplete() { + // Idempotent: only signal completion once, even if called multiple times + if (completed) { + log.fine("SSEEventListener.onComplete() called again - ignoring (already completed)"); + return; + } + completed = true; + + // Signal normal stream completion (null error means successful completion) + log.fine("SSEEventListener.onComplete() called - signaling successful stream completion"); + if (errorHandler != null) { + log.fine("Calling errorHandler.accept(null) to signal successful completion"); + errorHandler.accept(null); + } else { + log.warning("errorHandler is null, cannot signal completion"); + } + } + + private void handleMessage(JsonObject jsonObject, Future future) throws JsonProcessingException { + if (jsonObject.has("error")) { + JSONRPCError error = JsonUtil.fromJson(jsonObject.get("error").toString(), JSONRPCError.class); + if (errorHandler != null) { + errorHandler.accept(error); + } + } else if (jsonObject.has("result")) { + // result can be a Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent + String resultJson = jsonObject.get("result").toString(); + StreamingEventKind event = JsonUtil.fromJson(resultJson, StreamingEventKind.class); + eventHandler.accept(event); + if (event instanceof TaskStatusUpdateEvent && ((TaskStatusUpdateEvent) event).isFinal()) { + future.cancel(true); // close SSE channel + } + } else { + throw new IllegalArgumentException("Unknown message type"); + } + } + +} diff --git a/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider b/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider new file mode 100644 index 000000000..30ec70de9 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.jsonrpc.JSONRPCTransportProvider \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreamingTest.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreamingTest.java new file mode 100644 index 000000000..cf7ae69c6 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportStreamingTest.java @@ -0,0 +1,174 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages.SEND_MESSAGE_STREAMING_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages.SEND_MESSAGE_STREAMING_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages.TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages.TASK_RESUBSCRIPTION_TEST_REQUEST; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TextPart; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class JSONRPCTransportStreamingTest { + + private ClientAndServer server; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + @Test + public void testSendStreamingMessageParams() { + // The goal here is just to verify the correct parameters are being used + // This is a unit test of the parameter construction, not the streaming itself + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("test message"))) + .contextId("context-test") + .messageId("message-test") + .build(); + + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + assertNotNull(params); + assertEquals(message, params.message()); + assertEquals(configuration, params.configuration()); + assertEquals(Message.Role.USER, params.message().getRole()); + assertEquals("test message", ((TextPart) params.message().getParts().get(0)).getText()); + } + + @Test + public void testA2AClientSendStreamingMessage() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_STREAMING_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(SEND_MESSAGE_STREAMING_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me some jokes"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.sendMessageStreaming(params, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + assertNotNull(receivedEvent.get()); + } + + @Test + public void testA2AClientResubscribeToTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(TASK_RESUBSCRIPTION_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + TaskIdParams taskIdParams = new TaskIdParams("task-1234"); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.resubscribe(taskIdParams, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + + StreamingEventKind eventKind = receivedEvent.get();; + assertNotNull(eventKind); + assertInstanceOf(Task.class, eventKind); + Task task = (Task) eventKind; + assertEquals("2", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + List artifacts = task.getArtifacts(); + assertEquals(1, artifacts.size()); + Artifact artifact = artifacts.get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) part).getText()); + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportTest.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportTest.java new file mode 100644 index 000000000..f82f2eacf --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JSONRPCTransportTest.java @@ -0,0 +1,683 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.AGENT_CARD; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.AGENT_CARD_SUPPORTS_EXTENDED; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.CANCEL_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.CANCEL_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.GET_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_ERROR_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_ERROR_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.DataPart; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.FileContent; +import org.a2aproject.sdk.compat03.spec.FilePart; +import org.a2aproject.sdk.compat03.spec.FileWithBytes; +import org.a2aproject.sdk.compat03.spec.FileWithUri; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.SecurityScheme; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class JSONRPCTransportTest { + + private ClientAndServer server; + + @BeforeEach + public void setUp() { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + @Test + public void testA2AClientSendMessage() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind result = client.sendMessage(params, null); + assertInstanceOf(Task.class, result); + Task task = (Task) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState.COMPLETED,task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithMessageResponse() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind result = client.sendMessage(params, null); + assertInstanceOf(Message.class, result); + Message agentMessage = (Message) result; + assertEquals(Message.Role.AGENT, agentMessage.getRole()); + Part part = agentMessage.getParts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) part).getText()); + assertEquals("msg-456", agentMessage.getMessageId()); + } + + + @Test + public void testA2AClientSendMessageWithError() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_ERROR_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_ERROR_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + try { + client.sendMessage(params, null); + fail(); // should not reach here + } catch (A2AClientException e) { + assertTrue(e.getMessage().contains("Invalid parameters: Hello world")); + } + } + + @Test + public void testA2AClientGetTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Task task = client.getTask(new TaskQueryParams("de38c76d-d54c-436c-8b9f-4c2703648d64", + 10), null); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals("c295ea44-7543-4f78-b524-7a38915ad6e4", task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals(1, artifact.parts().size()); + assertEquals("artifact-1", artifact.artifactId()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + List history = task.getHistory(); + assertNotNull(history); + assertEquals(1, history.size()); + Message message = history.get(0); + assertEquals(Message.Role.USER, message.getRole()); + List> parts = message.getParts(); + assertNotNull(parts); + assertEquals(3, parts.size()); + part = parts.get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("tell me a joke", ((TextPart)part).getText()); + part = parts.get(1); + assertEquals(Part.Kind.FILE, part.getKind()); + FileContent filePart = ((FilePart) part).getFile(); + assertEquals("file:///path/to/file.txt", ((FileWithUri) filePart).uri()); + assertEquals("text/plain", filePart.mimeType()); + part = parts.get(2); + assertEquals(Part.Kind.FILE, part.getKind()); + filePart = ((FilePart) part).getFile(); + assertEquals("aGVsbG8=", ((FileWithBytes) filePart).bytes()); + assertEquals("hello.txt", filePart.name()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientCancelTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(CANCEL_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(CANCEL_TASK_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Task task = client.cancelTask(new TaskIdParams("de38c76d-d54c-436c-8b9f-4c2703648d64", + new HashMap<>()), null); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals("c295ea44-7543-4f78-b524-7a38915ad6e4", task.getContextId()); + assertEquals(TaskState.CANCELED, task.getStatus().state()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientGetTaskPushNotificationConfig() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + TaskPushNotificationConfig taskPushNotificationConfig = client.getTaskPushNotificationConfiguration( + new GetTaskPushNotificationConfigParams("de38c76d-d54c-436c-8b9f-4c2703648d64", null, + new HashMap<>()), null); + PushNotificationConfig pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + @Test + public void testA2AClientSetTaskPushNotificationConfig() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + TaskPushNotificationConfig taskPushNotificationConfig = client.setTaskPushNotificationConfiguration( + new TaskPushNotificationConfig("de38c76d-d54c-436c-8b9f-4c2703648d64", + new PushNotificationConfig.Builder() + .url("https://example.com/callback") + .authenticationInfo(new PushNotificationAuthenticationInfo(Collections.singletonList("jwt"), + null)) + .build()), null); + PushNotificationConfig pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo authenticationInfo = pushNotificationConfig.authentication(); + assertEquals(1, authenticationInfo.schemes().size()); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + + @Test + public void testA2AClientGetAgentCard() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/.well-known/agent-card.json") + ) + .respond( + response() + .withStatusCode(200) + .withBody(AGENT_CARD) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + AgentCard agentCard = client.getAgentCard(null); + assertEquals("GeoSpatial Route Planner Agent", agentCard.name()); + assertEquals("Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", agentCard.description()); + assertEquals("https://georoute-agent.example.com/a2a/v1", agentCard.url()); + assertEquals("Example Geo Services Inc.", agentCard.provider().organization()); + assertEquals("https://www.examplegeoservices.com", agentCard.provider().url()); + assertEquals("1.2.0", agentCard.version()); + assertEquals("https://docs.examplegeoservices.com/georoute-agent/api", agentCard.documentationUrl()); + assertTrue(agentCard.capabilities().streaming()); + assertTrue(agentCard.capabilities().pushNotifications()); + assertFalse(agentCard.capabilities().stateTransitionHistory()); + Map securitySchemes = agentCard.securitySchemes(); + assertNotNull(securitySchemes); + OpenIdConnectSecurityScheme google = (OpenIdConnectSecurityScheme) securitySchemes.get("google"); + assertEquals("openIdConnect", google.getType()); + assertEquals("https://accounts.google.com/.well-known/openid-configuration", google.getOpenIdConnectUrl()); + List>> security = agentCard.security(); + assertEquals(1, security.size()); + Map> securityMap = security.get(0); + List scopes = securityMap.get("google"); + List expectedScopes = List.of("openid", "profile", "email"); + assertEquals(expectedScopes, scopes); + List defaultInputModes = List.of("application/json", "text/plain"); + assertEquals(defaultInputModes, agentCard.defaultInputModes()); + List defaultOutputModes = List.of("application/json", "image/png"); + assertEquals(defaultOutputModes, agentCard.defaultOutputModes()); + List skills = agentCard.skills(); + assertEquals("route-optimizer-traffic", skills.get(0).id()); + assertEquals("Traffic-Aware Route Optimizer", skills.get(0).name()); + assertEquals("Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", skills.get(0).description()); + List tags = List.of("maps", "routing", "navigation", "directions", "traffic"); + assertEquals(tags, skills.get(0).tags()); + List examples = List.of("Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\"origin\": {\"lat\": 37.422, \"lng\": -122.084}, \"destination\": {\"lat\": 37.7749, \"lng\": -122.4194}, \"preferences\": [\"avoid_ferries\"]}"); + assertEquals(examples, skills.get(0).examples()); + assertEquals(defaultInputModes, skills.get(0).inputModes()); + List outputModes = List.of("application/json", "application/vnd.geo+json", "text/html"); + assertEquals(outputModes, skills.get(0).outputModes()); + assertEquals("custom-map-generator", skills.get(1).id()); + assertEquals("Personalized Map Generator", skills.get(1).name()); + assertEquals("Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", skills.get(1).description()); + tags = List.of("maps", "customization", "visualization", "cartography"); + assertEquals(tags, skills.get(1).tags()); + examples = List.of("Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location."); + assertEquals(examples, skills.get(1).examples()); + List inputModes = List.of("application/json"); + assertEquals(inputModes, skills.get(1).inputModes()); + outputModes = List.of("image/png", "image/jpeg", "application/json", "text/html"); + assertEquals(outputModes, skills.get(1).outputModes()); + assertFalse(agentCard.supportsAuthenticatedExtendedCard()); + assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl()); + assertEquals("0.2.9", agentCard.protocolVersion()); + assertEquals("JSONRPC", agentCard.preferredTransport()); + List additionalInterfaces = agentCard.additionalInterfaces(); + assertEquals(3, additionalInterfaces.size()); + AgentInterface jsonrpc = new AgentInterface(TransportProtocol.JSONRPC.asString(), "https://georoute-agent.example.com/a2a/v1"); + AgentInterface grpc = new AgentInterface(TransportProtocol.GRPC.asString(), "https://georoute-agent.example.com/a2a/grpc"); + AgentInterface httpJson = new AgentInterface(TransportProtocol.HTTP_JSON.asString(), "https://georoute-agent.example.com/a2a/json"); + assertEquals(jsonrpc, additionalInterfaces.get(0)); + assertEquals(grpc, additionalInterfaces.get(1)); + assertEquals(httpJson, additionalInterfaces.get(2)); + } + + @Test + public void testA2AClientGetAuthenticatedExtendedAgentCard() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/.well-known/agent-card.json") + ) + .respond( + response() + .withStatusCode(200) + .withBody(AGENT_CARD_SUPPORTS_EXTENDED) + ); + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + AgentCard agentCard = client.getAgentCard(null); + assertEquals("GeoSpatial Route Planner Agent Extended", agentCard.name()); + assertEquals("Extended description", agentCard.description()); + assertEquals("https://georoute-agent.example.com/a2a/v1", agentCard.url()); + assertEquals("Example Geo Services Inc.", agentCard.provider().organization()); + assertEquals("https://www.examplegeoservices.com", agentCard.provider().url()); + assertEquals("1.2.0", agentCard.version()); + assertEquals("https://docs.examplegeoservices.com/georoute-agent/api", agentCard.documentationUrl()); + assertTrue(agentCard.capabilities().streaming()); + assertTrue(agentCard.capabilities().pushNotifications()); + assertFalse(agentCard.capabilities().stateTransitionHistory()); + Map securitySchemes = agentCard.securitySchemes(); + assertNotNull(securitySchemes); + OpenIdConnectSecurityScheme google = (OpenIdConnectSecurityScheme) securitySchemes.get("google"); + assertEquals("openIdConnect", google.getType()); + assertEquals("https://accounts.google.com/.well-known/openid-configuration", google.getOpenIdConnectUrl()); + List>> security = agentCard.security(); + assertEquals(1, security.size()); + Map> securityMap = security.get(0); + List scopes = securityMap.get("google"); + List expectedScopes = List.of("openid", "profile", "email"); + assertEquals(expectedScopes, scopes); + List defaultInputModes = List.of("application/json", "text/plain"); + assertEquals(defaultInputModes, agentCard.defaultInputModes()); + List defaultOutputModes = List.of("application/json", "image/png"); + assertEquals(defaultOutputModes, agentCard.defaultOutputModes()); + List skills = agentCard.skills(); + assertEquals("route-optimizer-traffic", skills.get(0).id()); + assertEquals("Traffic-Aware Route Optimizer", skills.get(0).name()); + assertEquals("Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", skills.get(0).description()); + List tags = List.of("maps", "routing", "navigation", "directions", "traffic"); + assertEquals(tags, skills.get(0).tags()); + List examples = List.of("Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\"origin\": {\"lat\": 37.422, \"lng\": -122.084}, \"destination\": {\"lat\": 37.7749, \"lng\": -122.4194}, \"preferences\": [\"avoid_ferries\"]}"); + assertEquals(examples, skills.get(0).examples()); + assertEquals(defaultInputModes, skills.get(0).inputModes()); + List outputModes = List.of("application/json", "application/vnd.geo+json", "text/html"); + assertEquals(outputModes, skills.get(0).outputModes()); + assertEquals("custom-map-generator", skills.get(1).id()); + assertEquals("Personalized Map Generator", skills.get(1).name()); + assertEquals("Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", skills.get(1).description()); + tags = List.of("maps", "customization", "visualization", "cartography"); + assertEquals(tags, skills.get(1).tags()); + examples = List.of("Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location."); + assertEquals(examples, skills.get(1).examples()); + List inputModes = List.of("application/json"); + assertEquals(inputModes, skills.get(1).inputModes()); + outputModes = List.of("image/png", "image/jpeg", "application/json", "text/html"); + assertEquals(outputModes, skills.get(1).outputModes()); + assertEquals("skill-extended", skills.get(2).id()); + assertEquals("Extended Skill", skills.get(2).name()); + assertEquals("This is an extended skill.", skills.get(2).description()); + assertEquals(List.of("extended"), skills.get(2).tags()); + assertTrue(agentCard.supportsAuthenticatedExtendedCard()); + assertEquals("https://georoute-agent.example.com/icon.png", agentCard.iconUrl()); + assertEquals("0.2.5", agentCard.protocolVersion()); + } + + @Test + public void testA2AClientSendMessageWithFilePart() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(List.of( + new TextPart("analyze this image"), + new FilePart(new FileWithUri("image/jpeg", null, "file:///path/to/image.jpg")) + )) + .contextId("context-1234") + .messageId("message-1234-with-file") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind result = client.sendMessage(params, null); + assertInstanceOf(Task.class, result); + Task task = (Task) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("image-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("This is an image of a cat sitting on a windowsill.", ((TextPart) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithDataPart() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + + Map data = new HashMap<>(); + data.put("temperature", 25.5); + data.put("humidity", 60.2); + data.put("location", "San Francisco"); + data.put("timestamp", "2024-01-15T10:30:00Z"); + + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(List.of( + new TextPart("process this data"), + new DataPart(data) + )) + .contextId("context-1234") + .messageId("message-1234-with-data") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind result = client.sendMessage(params, null); + assertInstanceOf(Task.class, result); + Task task = (Task) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("data-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco.", ((TextPart) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } + + @Test + public void testA2AClientSendMessageWithMixedParts() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/") + .withBody(JsonBody.json(SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE) + ); + + JSONRPCTransport client = new JSONRPCTransport("http://localhost:4001"); + + Map data = new HashMap<>(); + data.put("chartType", "bar"); + data.put("dataPoints", List.of(10, 20, 30, 40)); + data.put("labels", List.of("Q1", "Q2", "Q3", "Q4")); + + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(List.of( + new TextPart("analyze this data and image"), + new FilePart(new FileWithBytes("image/png", "chart.png", "aGVsbG8=")), + new DataPart(data) + )) + .contextId("context-1234") + .messageId("message-1234-with-mixed") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(true) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + + EventKind result = client.sendMessage(params, null); + assertInstanceOf(Task.class, result); + Task task = (Task) result; + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertNotNull(task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("mixed-analysis", artifact.name()); + assertEquals(1, artifact.parts().size()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40].", ((TextPart) part).getText()); + assertTrue(task.getMetadata().isEmpty()); + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages.java new file mode 100644 index 000000000..afe5718d0 --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonMessages.java @@ -0,0 +1,769 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonMessages { + + static final String AGENT_CARD = """ + { + "protocolVersion": "0.2.9", + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "preferredTransport": "JSONRPC", + "additionalInterfaces" : [ + {"url": "https://georoute-agent.example.com/a2a/v1", "transport": "JSONRPC"}, + {"url": "https://georoute-agent.example.com/a2a/grpc", "transport": "GRPC"}, + {"url": "https://georoute-agent.example.com/a2a/json", "transport": "HTTP+JSON"} + ], + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": false, + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.9", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "joke", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + + static final String SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ], + "messageId": "msg-456", + "kind": "message" + } + }"""; + + static final String SEND_MESSAGE_WITH_ERROR_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_ERROR_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "error": { + "code": -32702, + "message": "Invalid parameters", + "data": "Hello world" + } + }"""; + + static final String GET_TASK_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/get", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "historyLength": 10 + } + } + """; + + static final String GET_TASK_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "history": [ + { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/file.txt", + "mimeType": "text/plain" + } + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "hello.txt" + } + } + ], + "messageId": "message-123", + "kind": "message" + } + ], + "metadata": {}, + "kind": "task" + } + } + """; + + static final String CANCEL_TASK_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/cancel", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "metadata": {} + } + } + """; + + static final String CANCEL_TASK_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "canceled" + }, + "metadata": {}, + "kind" : "task" + } + } + """; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/pushNotificationConfig/get", + "params": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "metadata": {}, + } + } + """; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + } + """; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/pushNotificationConfig/set", + "params": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }"""; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "taskId": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + } + """; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this image" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/image.jpg", + "mimeType": "image/jpeg" + } + } + ], + "messageId": "message-1234-with-file", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "image-analysis", + "parts": [ + { + "kind": "text", + "text": "This is an image of a cat sitting on a windowsill." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "process this data" + }, + { + "kind": "data", + "data": { + "temperature": 25.5, + "humidity": 60.2, + "location": "San Francisco", + "timestamp": "2024-01-15T10:30:00Z" + } + } + ], + "messageId": "message-1234-with-data", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "data-analysis", + "parts": [ + { + "kind": "text", + "text": "Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this data and image" + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "chart.png", + "mimeType": "image/png" + } + }, + { + "kind": "data", + "data": { + "chartType": "bar", + "dataPoints": [10, 20, 30, 40], + "labels": ["Q1", "Q2", "Q3", "Q4"] + } + } + ], + "messageId": "message-1234-with-mixed", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "mixed-analysis", + "parts": [ + { + "kind": "text", + "text": "Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40]." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "agent/getAuthenticatedExtendedCard" + } + """; + + static final String GET_AUTHENTICATED_EXTENDED_AGENT_CARD_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": "1", + "result": { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdUI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + } + }"""; + + static final String AGENT_CARD_SUPPORTS_EXTENDED = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; +} diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages.java new file mode 100644 index 000000000..85f4eacca --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/JsonStreamingMessages.java @@ -0,0 +1,145 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc; + +/** + * Contains JSON strings for testing SSE streaming. + */ +public class JsonStreamingMessages { + + public static final String STREAMING_TASK_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "task", + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working" + } + } + } + """; + + + public static final String STREAMING_MESSAGE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "message", + "role": "agent", + "messageId": "msg-123", + "contextId": "context-456", + "parts": [ + { + "kind": "text", + "text": "Hello, world!" + } + ] + } + }"""; + + public static final String STREAMING_STATUS_UPDATE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "taskId": "1", + "contextId": "2", + "status": { + "state": "submitted" + }, + "final": false, + "kind": "status-update" + } + }"""; + + public static final String STREAMING_STATUS_UPDATE_EVENT_FINAL = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "taskId": "1", + "contextId": "2", + "status": { + "state": "completed" + }, + "final": true, + "kind": "status-update" + } + }"""; + + public static final String STREAMING_ARTIFACT_UPDATE_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "result": { + "kind": "artifact-update", + "taskId": "1", + "contextId": "2", + "append": false, + "lastChunk": true, + "artifact": { + "artifactId": "artifact-1", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + } + }"""; + + public static final String STREAMING_ERROR_EVENT = """ + data: { + "jsonrpc": "2.0", + "id": "1234", + "error": { + "code": -32602, + "message": "Invalid parameters", + "data": "Missing required field" + } + }"""; + + public static final String SEND_MESSAGE_STREAMING_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/stream", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": false + }, + } + }"""; + + static final String SEND_MESSAGE_STREAMING_TEST_RESPONSE = + "event: message\n" + + "data: {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"completed\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"kind\":\"text\",\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{},\"kind\":\"task\"}}\n\n"; + + static final String TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE = + "event: message\n" + + "data: {\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"completed\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"kind\":\"text\",\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{},\"kind\":\"task\"}}\n\n"; + + public static final String TASK_RESUBSCRIPTION_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/resubscribe", + "params": { + "id": "task-1234" + } + }"""; +} \ No newline at end of file diff --git a/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListenerTest.java b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListenerTest.java new file mode 100644 index 000000000..a88b3e83c --- /dev/null +++ b/compat-0.3/client/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/client/transport/jsonrpc/sse/SSEEventListenerTest.java @@ -0,0 +1,267 @@ +package org.a2aproject.sdk.compat03.client.transport.jsonrpc.sse; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import org.a2aproject.sdk.compat03.client.transport.jsonrpc.JsonStreamingMessages; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.junit.jupiter.api.Test; + +public class SSEEventListenerTest { + + @Test + public void testOnEventWithTaskResult() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the task event JSON + String eventData = JsonStreamingMessages.STREAMING_TASK_EVENT.substring( + JsonStreamingMessages.STREAMING_TASK_EVENT.indexOf("{")); + + // Call the onEvent method directly + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof Task); + Task task = (Task) receivedEvent.get(); + assertEquals("task-123", task.getId()); + assertEquals("context-456", task.getContextId()); + assertEquals(TaskState.WORKING, task.getStatus().state()); + } + + @Test + public void testOnEventWithMessageResult() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages.STREAMING_MESSAGE_EVENT.substring( + JsonStreamingMessages.STREAMING_MESSAGE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof Message); + Message message = (Message) receivedEvent.get(); + assertEquals(Message.Role.AGENT, message.getRole()); + assertEquals("msg-123", message.getMessageId()); + assertEquals("context-456", message.getContextId()); + assertEquals(1, message.getParts().size()); + assertTrue(message.getParts().get(0) instanceof TextPart); + assertEquals("Hello, world!", ((TextPart) message.getParts().get(0)).getText()); + } + + @Test + public void testOnEventWithTaskStatusUpdateEventEvent() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages.STREAMING_STATUS_UPDATE_EVENT.substring( + JsonStreamingMessages.STREAMING_STATUS_UPDATE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskStatusUpdateEvent); + TaskStatusUpdateEvent taskStatusUpdateEvent = (TaskStatusUpdateEvent) receivedEvent.get(); + assertEquals("1", taskStatusUpdateEvent.getTaskId()); + assertEquals("2", taskStatusUpdateEvent.getContextId()); + assertFalse(taskStatusUpdateEvent.isFinal()); + assertEquals(TaskState.SUBMITTED, taskStatusUpdateEvent.getStatus().state()); + } + + @Test + public void testOnEventWithTaskArtifactUpdateEventEvent() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages.STREAMING_ARTIFACT_UPDATE_EVENT.substring( + JsonStreamingMessages.STREAMING_ARTIFACT_UPDATE_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskArtifactUpdateEvent); + + TaskArtifactUpdateEvent taskArtifactUpdateEvent = (TaskArtifactUpdateEvent) receivedEvent.get(); + assertEquals("1", taskArtifactUpdateEvent.getTaskId()); + assertEquals("2", taskArtifactUpdateEvent.getContextId()); + assertFalse(taskArtifactUpdateEvent.isAppend()); + assertTrue(taskArtifactUpdateEvent.isLastChunk()); + Artifact artifact = taskArtifactUpdateEvent.getArtifact(); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals(1, artifact.parts().size()); + assertEquals(Part.Kind.TEXT, artifact.parts().get(0).getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) artifact.parts().get(0)).getText()); + } + + @Test + public void testOnEventWithError() throws Exception { + // Set up event handler + AtomicReference receivedError = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> {}, + error -> receivedError.set(error) + ); + + // Parse the error event JSON + String eventData = JsonStreamingMessages.STREAMING_ERROR_EVENT.substring( + JsonStreamingMessages.STREAMING_ERROR_EVENT.indexOf("{")); + + // Call onEvent method + listener.onMessage(eventData, null); + + // Verify the error was processed correctly + assertNotNull(receivedError.get()); + assertInstanceOf(JSONRPCError.class, receivedError.get()); + JSONRPCError jsonrpcError = (JSONRPCError) receivedError.get(); + assertEquals(-32602, jsonrpcError.getCode()); + assertEquals("Invalid parameters", jsonrpcError.getMessage()); + assertEquals("Missing required field", jsonrpcError.getData()); + } + + @Test + public void testOnFailure() { + AtomicBoolean failureHandlerCalled = new AtomicBoolean(false); + SSEEventListener listener = new SSEEventListener( + event -> {}, + error -> failureHandlerCalled.set(true) + ); + + // Simulate a failure + CancelCapturingFuture future = new CancelCapturingFuture(); + listener.onError(new RuntimeException("Test exception"), future); + + // Verify the failure handler was called + assertTrue(failureHandlerCalled.get()); + // Verify it got cancelled + assertTrue(future.cancelHandlerCalled); + } + + @Test + public void testFinalTaskStatusUpdateEventCancels() { + TaskStatusUpdateEvent tsue = new TaskStatusUpdateEvent.Builder() + .taskId("1234") + .contextId("xyz") + .status(new TaskStatus(TaskState.COMPLETED)) + .isFinal(true) + .build(); + + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + + } + + @Test + public void testOnEventWithFinalTaskStatusUpdateEventEventCancels() throws Exception { + // Set up event handler + AtomicReference receivedEvent = new AtomicReference<>(); + SSEEventListener listener = new SSEEventListener( + event -> receivedEvent.set(event), + error -> {} + ); + + // Parse the message event JSON + String eventData = JsonStreamingMessages.STREAMING_STATUS_UPDATE_EVENT_FINAL.substring( + JsonStreamingMessages.STREAMING_STATUS_UPDATE_EVENT_FINAL.indexOf("{")); + + // Call onEvent method + CancelCapturingFuture future = new CancelCapturingFuture(); + listener.onMessage(eventData, future); + + // Verify the event was processed correctly + assertNotNull(receivedEvent.get()); + assertTrue(receivedEvent.get() instanceof TaskStatusUpdateEvent); + TaskStatusUpdateEvent taskStatusUpdateEvent = (TaskStatusUpdateEvent) receivedEvent.get(); + assertEquals("1", taskStatusUpdateEvent.getTaskId()); + assertEquals("2", taskStatusUpdateEvent.getContextId()); + assertTrue(taskStatusUpdateEvent.isFinal()); + assertEquals(TaskState.COMPLETED, taskStatusUpdateEvent.getStatus().state()); + + assertTrue(future.cancelHandlerCalled); + } + + + private static class CancelCapturingFuture implements Future { + private boolean cancelHandlerCalled; + + public CancelCapturingFuture() { + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + cancelHandlerCalled = true; + return true; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return false; + } + + @Override + public Void get() throws InterruptedException, ExecutionException { + return null; + } + + @Override + public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return null; + } + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/pom.xml b/compat-0.3/client/transport/rest/pom.xml new file mode 100644 index 000000000..9c36daf30 --- /dev/null +++ b/compat-0.3/client/transport/rest/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-rest + jar + + Java SDK A2A Compat 0.3 Client Transport: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - JSON+HTTP/REST Client Transport + + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + + + com.google.protobuf + protobuf-java-util + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + org.slf4j + slf4j-jdk14 + test + + + + \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper.java new file mode 100644 index 000000000..9990d631e --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestErrorMapper.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import com.google.gson.JsonObject; +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Utility class to A2AHttpResponse to appropriate A2A error types + */ +public class RestErrorMapper { + + public static A2AClientException mapRestError(A2AHttpResponse response) { + return RestErrorMapper.mapRestError(response.body(), response.status()); + } + + public static A2AClientException mapRestError(String body, int code) { + try { + if (body != null && !body.isBlank()) { + JsonObject node = JsonUtil.fromJson(body, JsonObject.class); + String className = node.has("error") ? node.get("error").getAsString() : ""; + String errorMessage = node.has("message") ? node.get("message").getAsString() : ""; + return mapRestError(className, errorMessage, code); + } + return mapRestError("", "", code); + } catch (JsonProcessingException ex) { + Logger.getLogger(RestErrorMapper.class.getName()).log(Level.SEVERE, null, ex); + return new A2AClientException("Failed to parse error response: " + ex.getMessage()); + } + } + + public static A2AClientException mapRestError(String className, String errorMessage, int code) { + return switch (className) { + case "org.a2aproject.sdk.compat03.spec.TaskNotFoundError" -> new A2AClientException(errorMessage, new TaskNotFoundError()); + case "org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError" -> new A2AClientException(errorMessage, new AuthenticatedExtendedCardNotConfiguredError(null, errorMessage, null)); + case "org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError" -> new A2AClientException(errorMessage, new ContentTypeNotSupportedError(null, null, errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InternalError" -> new A2AClientException(errorMessage, new InternalError(errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError" -> new A2AClientException(errorMessage, new InvalidAgentResponseError(null, null, errorMessage)); + case "org.a2aproject.sdk.compat03.spec.InvalidParamsError" -> new A2AClientException(errorMessage, new InvalidParamsError()); + case "org.a2aproject.sdk.compat03.spec.InvalidRequestError" -> new A2AClientException(errorMessage, new InvalidRequestError()); + case "org.a2aproject.sdk.compat03.spec.JSONParseError" -> new A2AClientException(errorMessage, new JSONParseError()); + case "org.a2aproject.sdk.compat03.spec.MethodNotFoundError" -> new A2AClientException(errorMessage, new MethodNotFoundError()); + case "org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError" -> new A2AClientException(errorMessage, new PushNotificationNotSupportedError()); + case "org.a2aproject.sdk.compat03.spec.TaskNotCancelableError" -> new A2AClientException(errorMessage, new TaskNotCancelableError()); + case "org.a2aproject.sdk.compat03.spec.UnsupportedOperationError" -> new A2AClientException(errorMessage, new UnsupportedOperationError()); + default -> new A2AClientException(errorMessage); + }; + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport.java new file mode 100644 index 000000000..3a3e3fdf1 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport.java @@ -0,0 +1,392 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import static org.a2aproject.sdk.util.Assert.checkNotNullParam; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.MessageOrBuilder; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.client.http.A2ACardResolver; +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.http.A2AHttpResponse; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.rest.sse.RestSSEEventListener; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransport; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders; +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.logging.Logger; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import org.jspecify.annotations.Nullable; + +public class RestTransport implements ClientTransport { + + private static final Logger log = Logger.getLogger(RestTransport.class.getName()); + private final A2AHttpClient httpClient; + private final String agentUrl; + private @Nullable final List interceptors; + private AgentCard agentCard; + private boolean needsExtendedCard = false; + + public RestTransport(AgentCard agentCard) { + this(null, agentCard, agentCard.url(), null); + } + + public RestTransport(@Nullable A2AHttpClient httpClient, AgentCard agentCard, + String agentUrl, @Nullable List interceptors) { + this.httpClient = httpClient == null ? new JdkA2AHttpClient() : httpClient; + this.agentCard = agentCard; + this.agentUrl = agentUrl.endsWith("/") ? agentUrl.substring(0, agentUrl.length() - 1) : agentUrl; + this.interceptors = interceptors; + } + + @Override + public EventKind sendMessage(MessageSendParams messageSendParams, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("messageSendParams", messageSendParams); + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(ProtoUtils.ToProto.sendMessageRequest(messageSendParams)); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.SendMessageRequest.METHOD, builder, agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + "/v1/message:send", payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + if (responseBuilder.hasMsg()) { + return ProtoUtils.FromProto.message(responseBuilder.getMsg()); + } + if (responseBuilder.hasTask()) { + return ProtoUtils.FromProto.task(responseBuilder.getTask()); + } + throw new A2AClientException("Failed to send message, wrong response:" + httpResponseBody); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to send message: " + e, e); + } + } + + @Override + public void sendMessageStreaming(MessageSendParams messageSendParams, Consumer eventConsumer, Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", messageSendParams); + checkNotNullParam("eventConsumer", eventConsumer); + checkNotNullParam("messageSendParams", messageSendParams); + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(ProtoUtils.ToProto.sendMessageRequest(messageSendParams)); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SendStreamingMessageRequest.METHOD, + builder, agentCard, context); + AtomicReference> ref = new AtomicReference<>(); + RestSSEEventListener sseEventListener = new RestSSEEventListener(eventConsumer, errorConsumer); + try { + A2AHttpClient.PostBuilder postBuilder = createPostBuilder(agentUrl + "/v1/message:stream", payloadAndHeaders); + ref.set(postBuilder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // We don't need to do anything special on completion + })); + } catch (IOException e) { + throw new A2AClientException("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException e) { + throw new A2AClientException("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public Task getTask(TaskQueryParams taskQueryParams, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("taskQueryParams", taskQueryParams); + GetTaskRequest.Builder builder = GetTaskRequest.newBuilder(); + builder.setName("tasks/" + taskQueryParams.id()); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.GetTaskRequest.METHOD, builder, + agentCard, context); + try { + String url; + if (taskQueryParams.historyLength() > 0) { + url = agentUrl + String.format("/v1/tasks/%1s?historyLength=%2d", taskQueryParams.id(), taskQueryParams.historyLength()); + } else { + url = agentUrl + String.format("/v1/tasks/%1s", taskQueryParams.id()); + } + A2AHttpClient.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.Task.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils.FromProto.task(responseBuilder); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException("Failed to get task: " + e, e); + } + } + + @Override + public Task cancelTask(TaskIdParams taskIdParams, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("taskIdParams", taskIdParams); + CancelTaskRequest.Builder builder = CancelTaskRequest.newBuilder(); + builder.setName("tasks/" + taskIdParams.id()); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.CancelTaskRequest.METHOD, builder, + agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + String.format("/v1/tasks/%1s:cancel", taskIdParams.id()), payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.Task.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils.FromProto.task(responseBuilder); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to cancel task: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + CreateTaskPushNotificationConfigRequest.Builder builder = CreateTaskPushNotificationConfigRequest.newBuilder(); + builder.setConfig(ProtoUtils.ToProto.taskPushNotificationConfig(request)) + .setParent("tasks/" + request.taskId()); + if (request.pushNotificationConfig().id() != null) { + builder.setConfigId(request.pushNotificationConfig().id()); + } + PayloadAndHeaders payloadAndHeaders = applyInterceptors(SetTaskPushNotificationConfigRequest.METHOD, builder, agentCard, context); + try { + String httpResponseBody = sendPostRequest(agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs", request.taskId()), payloadAndHeaders); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils.FromProto.taskPushNotificationConfig(responseBuilder); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to set task push notification config: " + e, e); + } + } + + @Override + public TaskPushNotificationConfig getTaskPushNotificationConfiguration(GetTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + GetTaskPushNotificationConfigRequest.Builder builder = GetTaskPushNotificationConfigRequest.newBuilder(); + builder.setName(String.format("/tasks/%1s/pushNotificationConfigs/%2s", request.id(), request.pushNotificationConfigId())); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs/%2s", request.id(), request.pushNotificationConfigId()); + A2AHttpClient.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils.FromProto.taskPushNotificationConfig(responseBuilder); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException("Failed to get push notifications: " + e, e); + } + } + + @Override + public List listTaskPushNotificationConfigurations(ListTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + ListTaskPushNotificationConfigRequest.Builder builder = ListTaskPushNotificationConfigRequest.newBuilder(); + builder.setParent(String.format("/tasks/%1s/pushNotificationConfigs", request.id())); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs", request.id()); + A2AHttpClient.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper.mapRestError(response); + } + String httpResponseBody = response.body(); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder responseBuilder = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(); + JsonFormat.parser().merge(httpResponseBody, responseBuilder); + return ProtoUtils.FromProto.listTaskPushNotificationConfigParams(responseBuilder); + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException("Failed to list push notifications: " + e, e); + } + } + + @Override + public void deleteTaskPushNotificationConfigurations(DeleteTaskPushNotificationConfigParams request, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder builder = org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder(); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest.METHOD, builder, + agentCard, context); + try { + String url = agentUrl + String.format("/v1/tasks/%1s/pushNotificationConfigs/%2s", request.id(), request.pushNotificationConfigId()); + A2AHttpClient.DeleteBuilder deleteBuilder = httpClient.createDelete().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + deleteBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse response = deleteBuilder.delete(); + if (!response.success()) { + throw RestErrorMapper.mapRestError(response); + } + } catch (A2AClientException e) { + throw e; + } catch (IOException | InterruptedException e) { + throw new A2AClientException("Failed to delete push notification config: " + e, e); + } + } + + @Override + public void resubscribe(TaskIdParams request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException { + checkNotNullParam("request", request); + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.newBuilder(); + builder.setName("tasks/" + request.id()); + PayloadAndHeaders payloadAndHeaders = applyInterceptors(org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest.METHOD, builder, + agentCard, context); + AtomicReference> ref = new AtomicReference<>(); + RestSSEEventListener sseEventListener = new RestSSEEventListener(eventConsumer, errorConsumer); + try { + String url = agentUrl + String.format("/v1/tasks/%1s:subscribe", request.id()); + A2AHttpClient.PostBuilder postBuilder = createPostBuilder(url, payloadAndHeaders); + ref.set(postBuilder.postAsyncSSE( + msg -> sseEventListener.onMessage(msg, ref.get()), + throwable -> sseEventListener.onError(throwable, ref.get()), + () -> { + // We don't need to do anything special on completion + })); + } catch (IOException e) { + throw new A2AClientException("Failed to send streaming message request: " + e, e); + } catch (InterruptedException e) { + throw new A2AClientException("Send streaming message request timed out: " + e, e); + } catch (JsonProcessingException e) { + throw new A2AClientException("Failed to process JSON for streaming message request: " + e, e); + } + } + + @Override + public AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException { + A2ACardResolver resolver; + try { + if (agentCard == null) { + resolver = new A2ACardResolver(httpClient, agentUrl, null, getHttpHeaders(context)); + agentCard = resolver.getAgentCard(); + needsExtendedCard = agentCard.supportsAuthenticatedExtendedCard(); + } + if (!needsExtendedCard) { + return agentCard; + } + PayloadAndHeaders payloadAndHeaders = applyInterceptors(GetAuthenticatedExtendedCardRequest.METHOD, null, + agentCard, context); + String url = agentUrl + String.format("/v1/card"); + A2AHttpClient.GetBuilder getBuilder = httpClient.createGet().url(url); + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + getBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + A2AHttpResponse response = getBuilder.get(); + if (!response.success()) { + throw RestErrorMapper.mapRestError(response); + } + String httpResponseBody = response.body(); + agentCard = JsonUtil.fromJson(httpResponseBody, AgentCard.class); + needsExtendedCard = false; + return agentCard; + } catch (IOException | InterruptedException | JsonProcessingException e) { + throw new A2AClientException("Failed to get authenticated extended agent card: " + e, e); + } catch (A2AClientError e) { + throw new A2AClientException("Failed to get agent card: " + e, e); + } + } + + @Override + public void close() { + // no-op + } + + private PayloadAndHeaders applyInterceptors(String methodName, @Nullable MessageOrBuilder payload, + AgentCard agentCard, @Nullable ClientCallContext clientCallContext) { + PayloadAndHeaders payloadAndHeaders = new PayloadAndHeaders(payload, getHttpHeaders(clientCallContext)); + if (interceptors != null && !interceptors.isEmpty()) { + for (ClientCallInterceptor interceptor : interceptors) { + payloadAndHeaders = interceptor.intercept(methodName, payloadAndHeaders.getPayload(), + payloadAndHeaders.getHeaders(), agentCard, clientCallContext); + } + } + return payloadAndHeaders; + } + + private String sendPostRequest(String url, PayloadAndHeaders payloadAndHeaders) throws IOException, InterruptedException, JsonProcessingException { + A2AHttpClient.PostBuilder builder = createPostBuilder(url, payloadAndHeaders); + A2AHttpResponse response = builder.post(); + if (!response.success()) { + log.fine("Error on POST processing " + JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + throw RestErrorMapper.mapRestError(response); + } + return response.body(); + } + + private A2AHttpClient.PostBuilder createPostBuilder(String url, PayloadAndHeaders payloadAndHeaders) throws JsonProcessingException, InvalidProtocolBufferException { + log.fine(JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + A2AHttpClient.PostBuilder postBuilder = httpClient.createPost() + .url(url) + .addHeader("Content-Type", "application/json") + .body(JsonFormat.printer().print((MessageOrBuilder) payloadAndHeaders.getPayload())); + + if (payloadAndHeaders.getHeaders() != null) { + for (Map.Entry entry : payloadAndHeaders.getHeaders().entrySet()) { + postBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + return postBuilder; + } + + private Map getHttpHeaders(@Nullable ClientCallContext context) { + return context != null ? context.getHeaders() : Collections.emptyMap(); + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig.java new file mode 100644 index 000000000..d92f3ac7b --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfig.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfig; +import org.jspecify.annotations.Nullable; + +public class RestTransportConfig extends ClientTransportConfig { + + private final @Nullable A2AHttpClient httpClient; + + public RestTransportConfig() { + this.httpClient = null; + } + + public RestTransportConfig(A2AHttpClient httpClient) { + this.httpClient = httpClient; + } + + public @Nullable A2AHttpClient getHttpClient() { + return httpClient; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder.java new file mode 100644 index 000000000..28bbbffc7 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportConfigBuilder.java @@ -0,0 +1,28 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.A2AHttpClient; +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportConfigBuilder; +import org.jspecify.annotations.Nullable; + +public class RestTransportConfigBuilder extends ClientTransportConfigBuilder { + + private @Nullable A2AHttpClient httpClient; + + public RestTransportConfigBuilder httpClient(A2AHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + @Override + public RestTransportConfig build() { + // No HTTP client provided, fallback to the default one (JDK-based implementation) + if (httpClient == null) { + httpClient = new JdkA2AHttpClient(); + } + + RestTransportConfig config = new RestTransportConfig(httpClient); + config.setInterceptors(this.interceptors); + return config; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider.java new file mode 100644 index 000000000..316264b38 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportProvider.java @@ -0,0 +1,29 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.a2aproject.sdk.compat03.client.http.JdkA2AHttpClient; +import org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +public class RestTransportProvider implements ClientTransportProvider { + + @Override + public String getTransportProtocol() { + return TransportProtocol.HTTP_JSON.asString(); + } + + @Override + public RestTransport create(RestTransportConfig clientTransportConfig, AgentCard agentCard, String agentUrl) throws A2AClientException { + RestTransportConfig transportConfig = clientTransportConfig; + if (transportConfig == null) { + transportConfig = new RestTransportConfig(new JdkA2AHttpClient()); + } + return new RestTransport(clientTransportConfig.getHttpClient(), agentCard, agentUrl, transportConfig.getInterceptors()); + } + + @Override + public Class getTransportProtocolClass() { + return RestTransport.class; + } +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java new file mode 100644 index 000000000..746922520 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.rest; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener.java new file mode 100644 index 000000000..c46116850 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/RestSSEEventListener.java @@ -0,0 +1,72 @@ +package org.a2aproject.sdk.compat03.client.transport.rest.sse; + +import static org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase.ARTIFACT_UPDATE; +import static org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase.MSG; +import static org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase.STATUS_UPDATE; +import static org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase.TASK; + +import java.util.concurrent.Future; +import java.util.function.Consumer; +import java.util.logging.Logger; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.client.transport.rest.RestErrorMapper; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.jspecify.annotations.Nullable; + +public class RestSSEEventListener { + + private static final Logger log = Logger.getLogger(RestSSEEventListener.class.getName()); + private final Consumer eventHandler; + private final Consumer errorHandler; + + public RestSSEEventListener(Consumer eventHandler, + Consumer errorHandler) { + this.eventHandler = eventHandler; + this.errorHandler = errorHandler; + } + + public void onMessage(String message, @Nullable Future completableFuture) { + try { + log.fine("Streaming message received: " + message); + org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder builder = org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder(); + JsonFormat.parser().merge(message, builder); + handleMessage(builder.build()); + } catch (InvalidProtocolBufferException e) { + errorHandler.accept(RestErrorMapper.mapRestError(message, 500)); + } + } + + public void onError(Throwable throwable, @Nullable Future future) { + if (errorHandler != null) { + errorHandler.accept(throwable); + } + if (future != null) { + future.cancel(true); // close SSE channel + } + } + + private void handleMessage(StreamResponse response) { + StreamingEventKind event; + switch (response.getPayloadCase()) { + case MSG -> + event = ProtoUtils.FromProto.message(response.getMsg()); + case TASK -> + event = ProtoUtils.FromProto.task(response.getTask()); + case STATUS_UPDATE -> + event = ProtoUtils.FromProto.taskStatusUpdateEvent(response.getStatusUpdate()); + case ARTIFACT_UPDATE -> + event = ProtoUtils.FromProto.taskArtifactUpdateEvent(response.getArtifactUpdate()); + default -> { + log.warning("Invalid stream response " + response.getPayloadCase()); + errorHandler.accept(new IllegalStateException("Invalid stream response from server: " + response.getPayloadCase())); + return; + } + } + eventHandler.accept(event); + } + +} diff --git a/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java new file mode 100644 index 000000000..38dfbf147 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/sse/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.rest.sse; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider b/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider new file mode 100644 index 000000000..9ba60e7d8 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/main/resources/META-INF/services/org.a2aproject.sdk.compat03.client.transport.spi.ClientTransportProvider @@ -0,0 +1 @@ +org.a2aproject.sdk.compat03.client.transport.rest.RestTransportProvider \ No newline at end of file diff --git a/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages.java b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages.java new file mode 100644 index 000000000..6afc5a529 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/JsonRestMessages.java @@ -0,0 +1,654 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonRestMessages { + + static final String SEND_MESSAGE_TEST_REQUEST = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "ROLE_USER", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE = """ + { + "task": { + "id": "9b511af4-b27c-47fa-aecf-2a93c08a44f8", + "contextId": "context-1234", + "status": { + "state": "TASK_STATE_SUBMITTED" + }, + "history": [ + { + "messageId": "message-1234", + "contextId": "context-1234", + "taskId": "9b511af4-b27c-47fa-aecf-2a93c08a44f8", + "role": "ROLE_USER", + "content": [ + { + "text": "tell me a joke" + } + ], + "metadata": {} + } + ] + } + }"""; + + static final String CANCEL_TASK_TEST_REQUEST = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64" + }"""; + + static final String CANCEL_TASK_TEST_RESPONSE = """ + { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "TASK_STATE_CANCELLED" + }, + "metadata": {} + }"""; + + static final String GET_TASK_TEST_RESPONSE = """ + { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "TASK_STATE_COMPLETED" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "parts": [ + { + "text": "Why did the chicken cross the road? To get to the other side!" + } + ] + } + ], + "history": [ + { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me a joke" + }, + { + "file": { + "file_with_uri": "file:///path/to/file.txt", + "mimeType": "text/plain" + } + }, + { + "file": { + "file_with_bytes": "aGVsbG8=", + "mimeType": "text/plain" + } + } + ], + "messageId": "message-123" + } + ], + "metadata": {} + } + """; + + static final String AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": false, + "protocolVersion": "0.2.5" + }"""; + + static final String AGENT_CARD_SUPPORTS_EXTENDED = """ + { + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.5" + }"""; + + static final String SEND_MESSAGE_TEST_REQUEST_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_TEST_RESPONSE_WITH_MESSAGE_RESPONSE = """ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Why did the chicken cross the road? To get to the other side!" + } + ], + "messageId": "msg-456", + "kind": "message" + } + }"""; + + static final String SEND_MESSAGE_WITH_ERROR_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "tell me a joke" + } + ], + "messageId": "message-1234", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + }, + } + }"""; + + static final String SEND_MESSAGE_ERROR_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "error": { + "code": -32702, + "message": "Invalid parameters", + "data": "Hello world" + } + }"""; + + static final String GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }"""; + static final String LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "configs":[ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }, + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/5", + "pushNotificationConfig": { + "url": "https://test.com/callback" + } + } + ] + }"""; + + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST = """ + { + "parent": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64", + "config": { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": [ "jwt" ] + } + } + } + }"""; + + static final String SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE = """ + { + "name": "tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this image" + }, + { + "kind": "file", + "file": { + "uri": "file:///path/to/image.jpg", + "mimeType": "image/jpeg" + } + } + ], + "messageId": "message-1234-with-file", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_FILE_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "image-analysis", + "parts": [ + { + "kind": "text", + "text": "This is an image of a cat sitting on a windowsill." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "process this data" + }, + { + "kind": "data", + "data": { + "temperature": 25.5, + "humidity": 60.2, + "location": "San Francisco", + "timestamp": "2024-01-15T10:30:00Z" + } + } + ], + "messageId": "message-1234-with-data", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_DATA_PART_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "data-analysis", + "parts": [ + { + "kind": "text", + "text": "Processed weather data: Temperature is 25.5°C, humidity is 60.2% in San Francisco." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "message/send", + "params": { + "message": { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "analyze this data and image" + }, + { + "kind": "file", + "file": { + "bytes": "aGVsbG8=", + "name": "chart.png", + "mimeType": "image/png" + } + }, + { + "kind": "data", + "data": { + "chartType": "bar", + "dataPoints": [10, 20, 30, 40], + "labels": ["Q1", "Q2", "Q3", "Q4"] + } + } + ], + "messageId": "message-1234-with-mixed", + "contextId": "context-1234", + "kind": "message" + }, + "configuration": { + "acceptedOutputModes": ["text"], + "blocking": true + } + } + }"""; + + static final String SEND_MESSAGE_WITH_MIXED_PARTS_TEST_RESPONSE = """ + { + "jsonrpc": "2.0", + "result": { + "id": "de38c76d-d54c-436c-8b9f-4c2703648d64", + "contextId": "c295ea44-7543-4f78-b524-7a38915ad6e4", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "mixed-analysis", + "parts": [ + { + "kind": "text", + "text": "Analyzed chart image and data: Bar chart showing quarterly data with values [10, 20, 30, 40]." + } + ] + } + ], + "metadata": {}, + "kind": "task" + } + }"""; + + public static final String SEND_MESSAGE_STREAMING_TEST_REQUEST = """ + { + "message": { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234" + }, + "configuration": { + "acceptedOutputModes": ["text"] + } + }"""; + static final String SEND_MESSAGE_STREAMING_TEST_RESPONSE + = "event: message\n" + + "data: {\"task\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"TASK_STATE_SUBMITTED\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{}}}\n\n"; + + static final String TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE + = "event: message\n" + + "data: {\"task\":{\"id\":\"2\",\"contextId\":\"context-1234\",\"status\":{\"state\":\"TASK_STATE_COMPLETED\"},\"artifacts\":[{\"artifactId\":\"artifact-1\",\"name\":\"joke\",\"parts\":[{\"text\":\"Why did the chicken cross the road? To get to the other side!\"}]}],\"metadata\":{}}}\n\n"; + public static final String TASK_RESUBSCRIPTION_TEST_REQUEST = """ + { + "jsonrpc": "2.0", + "method": "tasks/resubscribe", + "params": { + "id": "task-1234" + } + }"""; +} diff --git a/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportTest.java b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportTest.java new file mode 100644 index 000000000..8341da437 --- /dev/null +++ b/compat-0.3/client/transport/rest/src/test/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransportTest.java @@ -0,0 +1,452 @@ +package org.a2aproject.sdk.compat03.client.transport.rest; + + +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.CANCEL_TASK_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.CANCEL_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.GET_TASK_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SEND_MESSAGE_STREAMING_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SEND_MESSAGE_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SEND_MESSAGE_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SEND_MESSAGE_STREAMING_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE; +import static org.a2aproject.sdk.compat03.client.transport.rest.JsonRestMessages.TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.FilePart; +import org.a2aproject.sdk.compat03.spec.FileWithBytes; +import org.a2aproject.sdk.compat03.spec.FileWithUri; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.Part.Kind; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TextPart; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; +import java.util.logging.Logger; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.matchers.MatchType; +import org.mockserver.model.JsonBody; + +public class RestTransportTest { + + private static final Logger log = Logger.getLogger(RestTransportTest.class.getName()); + private ClientAndServer server; + private static final AgentCard CARD = new AgentCard.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:4001") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .build(); + + @BeforeEach + public void setUp() throws IOException { + server = new ClientAndServer(4001); + } + + @AfterEach + public void tearDown() { + server.stop(); + } + + public RestTransportTest() { + } + + /** + * Test of sendMessage method, of class JSONRestTransport. + */ + @Test + public void testSendMessage() throws Exception { + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .taskId("") + .build(); + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/message:send") + .withBody(JsonBody.json(SEND_MESSAGE_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(SEND_MESSAGE_TEST_RESPONSE) + ); + MessageSendParams messageSendParams = new MessageSendParams(message, null, null); + ClientCallContext context = null; + + RestTransport instance = new RestTransport(CARD); + EventKind result = instance.sendMessage(messageSendParams, context); + assertEquals("task", result.getKind()); + Task task = (Task) result; + assertEquals("9b511af4-b27c-47fa-aecf-2a93c08a44f8", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState.SUBMITTED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + assertEquals(true, task.getArtifacts().isEmpty()); + assertEquals(1, task.getHistory().size()); + Message history = task.getHistory().get(0); + assertEquals("message", history.getKind()); + assertEquals(Message.Role.USER, history.getRole()); + assertEquals("context-1234", history.getContextId()); + assertEquals("message-1234", history.getMessageId()); + assertEquals("9b511af4-b27c-47fa-aecf-2a93c08a44f8", history.getTaskId()); + assertEquals(1, history.getParts().size()); + assertEquals(Kind.TEXT, history.getParts().get(0).getKind()); + assertEquals("tell me a joke", ((TextPart) history.getParts().get(0)).getText()); + assertNull(history.getMetadata()); + assertNull(history.getReferenceTaskIds()); + } + + /** + * Test of cancelTask method, of class JSONRestTransport. + */ + @Test + public void testCancelTask() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64:cancel") + .withBody(JsonBody.json(CANCEL_TASK_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(CANCEL_TASK_TEST_RESPONSE) + ); + ClientCallContext context = null; + RestTransport instance = new RestTransport(CARD); + Task task = instance.cancelTask(new TaskIdParams("de38c76d-d54c-436c-8b9f-4c2703648d64", + new HashMap<>()), context); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals(TaskState.CANCELED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + } + + /** + * Test of getTask method, of class JSONRestTransport. + */ + @Test + public void testGetTask() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64") + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_TEST_RESPONSE) + ); + ClientCallContext context = null; + TaskQueryParams request = new TaskQueryParams("de38c76d-d54c-436c-8b9f-4c2703648d64", 10); + RestTransport instance = new RestTransport(CARD); + Task task = instance.getTask(request, context); + assertEquals("de38c76d-d54c-436c-8b9f-4c2703648d64", task.getId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertNull(task.getStatus().message()); + assertNull(task.getMetadata()); + assertEquals(false, task.getArtifacts().isEmpty()); + assertEquals(1, task.getArtifacts().size()); + Artifact artifact = task.getArtifacts().get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("", artifact.name()); + assertEquals(false, artifact.parts().isEmpty()); + assertEquals(Kind.TEXT, artifact.parts().get(0).getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) artifact.parts().get(0)).getText()); + assertEquals(1, task.getHistory().size()); + Message history = task.getHistory().get(0); + assertEquals("message", history.getKind()); + assertEquals(Message.Role.USER, history.getRole()); + assertEquals("message-123", history.getMessageId()); + assertEquals(3, history.getParts().size()); + assertEquals(Kind.TEXT, history.getParts().get(0).getKind()); + assertEquals("tell me a joke", ((TextPart) history.getParts().get(0)).getText()); + assertEquals(Kind.FILE, history.getParts().get(1).getKind()); + FilePart part = (FilePart) history.getParts().get(1); + assertEquals("text/plain", part.getFile().mimeType()); + assertEquals("file:///path/to/file.txt", ((FileWithUri) part.getFile()).uri()); + part = (FilePart) history.getParts().get(2); + assertEquals(Kind.FILE, part.getKind()); + assertEquals("text/plain", part.getFile().mimeType()); + assertEquals("hello", ((FileWithBytes) part.getFile()).bytes()); + assertNull(history.getMetadata()); + assertNull(history.getReferenceTaskIds()); + } + + /** + * Test of sendMessageStreaming method, of class JSONRestTransport. + */ + @Test + public void testSendMessageStreaming() throws Exception { + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/message:stream") + .withBody(JsonBody.json(SEND_MESSAGE_STREAMING_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(SEND_MESSAGE_STREAMING_TEST_RESPONSE) + ); + + RestTransport client = new RestTransport(CARD); + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me some jokes"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + MessageSendParams params = new MessageSendParams.Builder() + .message(message) + .configuration(configuration) + .build(); + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> { + }; + client.sendMessageStreaming(params, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + assertNotNull(receivedEvent.get()); + assertEquals("task", receivedEvent.get().getKind()); + Task task = (Task) receivedEvent.get(); + assertEquals("2", task.getId()); + } + + /** + * Test of setTaskPushNotificationConfiguration method, of class JSONRestTransport. + */ + @Test + public void testSetTaskPushNotificationConfiguration() throws Exception { + log.info("Testing setTaskPushNotificationConfiguration"); + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs") + .withBody(JsonBody.json(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_REQUEST, MatchType.ONLY_MATCHING_FIELDS)) + ) + .respond( + response() + .withStatusCode(200) + .withBody(SET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + RestTransport client = new RestTransport(CARD); + TaskPushNotificationConfig pushedConfig = new TaskPushNotificationConfig( + "de38c76d-d54c-436c-8b9f-4c2703648d64", + new PushNotificationConfig.Builder() + .url("https://example.com/callback") + .authenticationInfo( + new PushNotificationAuthenticationInfo(Collections.singletonList("jwt"), null)) + .build()); + TaskPushNotificationConfig taskPushNotificationConfig = client.setTaskPushNotificationConfiguration(pushedConfig, null); + PushNotificationConfig pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo authenticationInfo = pushNotificationConfig.authentication(); + assertEquals(1, authenticationInfo.schemes().size()); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + /** + * Test of getTaskPushNotificationConfiguration method, of class JSONRestTransport. + */ + @Test + public void testGetTaskPushNotificationConfiguration() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10") + ) + .respond( + response() + .withStatusCode(200) + .withBody(GET_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + RestTransport client = new RestTransport(CARD); + TaskPushNotificationConfig taskPushNotificationConfig = client.getTaskPushNotificationConfiguration( + new GetTaskPushNotificationConfigParams("de38c76d-d54c-436c-8b9f-4c2703648d64", "10", + new HashMap<>()), null); + PushNotificationConfig pushNotificationConfig = taskPushNotificationConfig.pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + PushNotificationAuthenticationInfo authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + } + + /** + * Test of listTaskPushNotificationConfigurations method, of class JSONRestTransport. + */ + @Test + public void testListTaskPushNotificationConfigurations() throws Exception { + this.server.when( + request() + .withMethod("GET") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs") + ) + .respond( + response() + .withStatusCode(200) + .withBody(LIST_TASK_PUSH_NOTIFICATION_CONFIG_TEST_RESPONSE) + ); + + RestTransport client = new RestTransport(CARD); + List taskPushNotificationConfigs = client.listTaskPushNotificationConfigurations( + new ListTaskPushNotificationConfigParams("de38c76d-d54c-436c-8b9f-4c2703648d64", new HashMap<>()), null); + assertEquals(2, taskPushNotificationConfigs.size()); + PushNotificationConfig pushNotificationConfig = taskPushNotificationConfigs.get(0).pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://example.com/callback", pushNotificationConfig.url()); + assertEquals("10", pushNotificationConfig.id()); + PushNotificationAuthenticationInfo authenticationInfo = pushNotificationConfig.authentication(); + assertTrue(authenticationInfo.schemes().size() == 1); + assertEquals("jwt", authenticationInfo.schemes().get(0)); + assertEquals("", authenticationInfo.credentials()); + pushNotificationConfig = taskPushNotificationConfigs.get(1).pushNotificationConfig(); + assertNotNull(pushNotificationConfig); + assertEquals("https://test.com/callback", pushNotificationConfig.url()); + assertEquals("5", pushNotificationConfig.id()); + authenticationInfo = pushNotificationConfig.authentication(); + assertNull(authenticationInfo); + } + + /** + * Test of deleteTaskPushNotificationConfigurations method, of class JSONRestTransport. + */ + @Test + public void testDeleteTaskPushNotificationConfigurations() throws Exception { + log.info("Testing deleteTaskPushNotificationConfigurations"); + this.server.when( + request() + .withMethod("DELETE") + .withPath("/v1/tasks/de38c76d-d54c-436c-8b9f-4c2703648d64/pushNotificationConfigs/10") + ) + .respond( + response() + .withStatusCode(200) + ); + ClientCallContext context = null; + RestTransport instance = new RestTransport(CARD); + instance.deleteTaskPushNotificationConfigurations(new DeleteTaskPushNotificationConfigParams("de38c76d-d54c-436c-8b9f-4c2703648d64", "10"), context); + } + + /** + * Test of resubscribe method, of class JSONRestTransport. + */ + @Test + public void testResubscribe() throws Exception { + log.info("Testing resubscribe"); + + this.server.when( + request() + .withMethod("POST") + .withPath("/v1/tasks/task-1234:subscribe") + ) + .respond( + response() + .withStatusCode(200) + .withHeader("Content-Type", "text/event-stream") + .withBody(TASK_RESUBSCRIPTION_REQUEST_TEST_RESPONSE) + ); + + RestTransport client = new RestTransport(CARD); + TaskIdParams taskIdParams = new TaskIdParams("task-1234"); + + AtomicReference receivedEvent = new AtomicReference<>(); + CountDownLatch latch = new CountDownLatch(1); + Consumer eventHandler = event -> { + receivedEvent.set(event); + latch.countDown(); + }; + Consumer errorHandler = error -> {}; + client.resubscribe(taskIdParams, eventHandler, errorHandler, null); + + boolean eventReceived = latch.await(10, TimeUnit.SECONDS); + assertTrue(eventReceived); + + StreamingEventKind eventKind = receivedEvent.get();; + assertNotNull(eventKind); + assertInstanceOf(Task.class, eventKind); + Task task = (Task) eventKind; + assertEquals("2", task.getId()); + assertEquals("context-1234", task.getContextId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + List artifacts = task.getArtifacts(); + assertEquals(1, artifacts.size()); + Artifact artifact = artifacts.get(0); + assertEquals("artifact-1", artifact.artifactId()); + assertEquals("joke", artifact.name()); + Part part = artifact.parts().get(0); + assertEquals(Part.Kind.TEXT, part.getKind()); + assertEquals("Why did the chicken cross the road? To get to the other side!", ((TextPart) part).getText()); + } +} diff --git a/compat-0.3/client/transport/spi/pom.xml b/compat-0.3/client/transport/spi/pom.xml new file mode 100644 index 000000000..9c9dc1c28 --- /dev/null +++ b/compat-0.3/client/transport/spi/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../../.. + + a2a-java-sdk-compat-0.3-client-transport-spi + jar + + Java SDK A2A Compat 0.3 Client Transport: SPI + Java SDK for the Agent2Agent Protocol (A2A) - Client Transport SPI + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport.java new file mode 100644 index 000000000..8ad9e0380 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransport.java @@ -0,0 +1,141 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import java.util.List; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.jspecify.annotations.Nullable; + +/** + * Interface for a client transport. + */ +public interface ClientTransport { + + /** + * Send a non-streaming message request to the agent. + * + * @param request the message send parameters + * @param context optional client call context for the request (may be {@code null}) + * @return the response, either a Task or Message + * @throws A2AClientException if sending the message fails for any reason + */ + EventKind sendMessage(MessageSendParams request, @Nullable ClientCallContext context) + throws A2AClientException; + + /** + * Send a streaming message request to the agent and receive responses as they arrive. + * + * @param request the message send parameters + * @param eventConsumer consumer that will receive streaming events as they arrive + * @param errorConsumer consumer that will be called if an error occurs during streaming + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if setting up the streaming connection fails + */ + void sendMessageStreaming(MessageSendParams request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the current state and history of a specific task. + * + * @param request the task query parameters specifying which task to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task + * @throws A2AClientException if retrieving the task fails for any reason + */ + Task getTask(TaskQueryParams request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Request the agent to cancel a specific task. + * + * @param request the task ID parameters specifying which task to cancel + * @param context optional client call context for the request (may be {@code null}) + * @return the cancelled task + * @throws A2AClientException if cancelling the task fails for any reason + */ + Task cancelTask(TaskIdParams request, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Set or update the push notification configuration for a specific task. + * + * @param request the push notification configuration to set for the task + * @param context optional client call context for the request (may be {@code null}) + * @return the configured TaskPushNotificationConfig + * @throws A2AClientException if setting the task push notification configuration fails for any reason + */ + TaskPushNotificationConfig setTaskPushNotificationConfiguration(TaskPushNotificationConfig request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the push notification configuration for a specific task. + * + * @param request the parameters specifying which task's notification config to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the task push notification config + * @throws A2AClientException if getting the task push notification config fails for any reason + */ + TaskPushNotificationConfig getTaskPushNotificationConfiguration( + GetTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to retrieve + * @param context optional client call context for the request (may be {@code null}) + * @return the list of task push notification configs + * @throws A2AClientException if getting the task push notification configs fails for any reason + */ + List listTaskPushNotificationConfigurations( + ListTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Delete the list of push notification configurations for a specific task. + * + * @param request the parameters specifying which task's notification configs to delete + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if deleting the task push notification configs fails for any reason + */ + void deleteTaskPushNotificationConfigurations( + DeleteTaskPushNotificationConfigParams request, + @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Reconnect to get task updates for an existing task. + * + * @param request the task ID parameters specifying which task to resubscribe to + * @param eventConsumer consumer that will receive streaming events as they arrive + * @param errorConsumer consumer that will be called if an error occurs during streaming + * @param context optional client call context for the request (may be {@code null}) + * @throws A2AClientException if resubscribing to the task fails for any reason + */ + void resubscribe(TaskIdParams request, Consumer eventConsumer, + Consumer errorConsumer, @Nullable ClientCallContext context) throws A2AClientException; + + /** + * Retrieve the AgentCard. + * + * @param context optional client call context for the request (may be {@code null}) + * @return the AgentCard + * @throws A2AClientException if retrieving the agent card fails for any reason + */ + AgentCard getAgentCard(@Nullable ClientCallContext context) throws A2AClientException; + + /** + * Close the transport and release any associated resources. + */ + void close(); + +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig.java new file mode 100644 index 000000000..e59c34509 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfig.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import java.util.ArrayList; + +import java.util.List; + +/** + * Configuration for an A2A client transport. + */ +public abstract class ClientTransportConfig { + + protected List interceptors = new ArrayList<>(); + + public void setInterceptors(List interceptors) { + this.interceptors = new ArrayList<>(interceptors); + } + + public List getInterceptors() { + return interceptors; + } +} \ No newline at end of file diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder.java new file mode 100644 index 000000000..177af8923 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportConfigBuilder.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; + +import java.util.ArrayList; +import java.util.List; + +public abstract class ClientTransportConfigBuilder, + B extends ClientTransportConfigBuilder> { + + protected List interceptors = new ArrayList<>(); + + public B addInterceptor(ClientCallInterceptor interceptor) { + if (interceptor != null) { + this.interceptors.add(interceptor); + } + + return (B) this; + } + + public abstract T build(); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider.java new file mode 100644 index 000000000..ad64ace26 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/ClientTransportProvider.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.a2aproject.sdk.compat03.spec.A2AClientException; +import org.a2aproject.sdk.compat03.spec.AgentCard; + +/** + * Client transport provider interface. + */ +public interface ClientTransportProvider> { + + /** + * Create a client transport. + * + * @param clientTransportConfig the client transport config to use + * @param agentCard the remote agent's agent card + * @param agentUrl the remote agent's URL + * @return the client transport + * @throws A2AClientException if an error occurs trying to create the client + */ + T create(C clientTransportConfig, AgentCard agentCard, + String agentUrl) throws A2AClientException; + + /** + * Get the name of the client transport. + */ + String getTransportProtocol(); + + Class getTransportProtocolClass(); +} + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext.java new file mode 100644 index 000000000..e433d8503 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallContext.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Map; + +/** + * A context passed with each client call, allowing for call-specific. + * configuration and data passing. Such as authentication details or + * request deadlines. + */ +public class ClientCallContext { + + private final Map state; + private final Map headers; + + public ClientCallContext(Map state, Map headers) { + this.state = state; + this.headers = headers; + } + + public Map getState() { + return state; + } + + public Map getHeaders() { + return headers; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor.java new file mode 100644 index 000000000..e4e8c637b --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/ClientCallInterceptor.java @@ -0,0 +1,27 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Map; + +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.jspecify.annotations.Nullable; + +/** + * An abstract base class for client-side call interceptors. + * Interceptors can inspect and modify requests before they are sent, + * which is ideal for concerns like authentication, logging, or tracing. + */ +public abstract class ClientCallInterceptor { + + /** + * Intercept a client call before the request is sent. + * + * @param methodName the name of the protocol method (e.g., 'message/send') + * @param payload the request payload + * @param headers the headers to use + * @param agentCard the agent card (may be {@code null}) + * @param clientCallContext the {@code ClientCallContext} for this call (may be {@code null}) + * @return the potentially modified payload and headers + */ + public abstract PayloadAndHeaders intercept(String methodName, @Nullable Object payload, Map headers, + AgentCard agentCard, @Nullable ClientCallContext clientCallContext); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders.java new file mode 100644 index 000000000..2263807f0 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/PayloadAndHeaders.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.jspecify.annotations.Nullable; + +public class PayloadAndHeaders { + + private final @Nullable Object payload; + private final Map headers; + + public PayloadAndHeaders(@Nullable Object payload, @Nullable Map headers) { + this.payload = payload; + this.headers = headers == null ? Collections.emptyMap() : new HashMap<>(headers); + } + + public @Nullable Object getPayload() { + return payload; + } + + public Map getHeaders() { + return headers; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor.java new file mode 100644 index 000000000..58d07f632 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptor.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme; +import org.a2aproject.sdk.compat03.spec.SecurityScheme; +import org.jspecify.annotations.Nullable; + +/** + * An interceptor that automatically adds authentication details to requests + * based on the agent's security schemes and the credentials available. + */ +public class AuthInterceptor extends ClientCallInterceptor { + + private static final String BEARER_SCHEME = "bearer"; + public static final String AUTHORIZATION = "Authorization"; + private static final String BEARER = "Bearer "; + private final CredentialService credentialService; + + public AuthInterceptor(final CredentialService credentialService) { + this.credentialService = credentialService; + } + + @Override + public PayloadAndHeaders intercept(String methodName, @Nullable Object payload, Map headers, + AgentCard agentCard, @Nullable ClientCallContext clientCallContext) { + Map updatedHeaders = new HashMap<>(headers == null ? new HashMap<>() : headers); + if (agentCard == null || agentCard.security() == null || agentCard.securitySchemes() == null) { + return new PayloadAndHeaders(payload, updatedHeaders); + } + for (Map> requirement : agentCard.security()) { + for (String securitySchemeName : requirement.keySet()) { + String credential = credentialService.getCredential(securitySchemeName, clientCallContext); + if (credential != null && agentCard.securitySchemes().containsKey(securitySchemeName)) { + SecurityScheme securityScheme = agentCard.securitySchemes().get(securitySchemeName); + if (securityScheme == null) { + continue; + } + if (securityScheme instanceof HTTPAuthSecurityScheme httpAuthSecurityScheme) { + if (httpAuthSecurityScheme.getScheme().toLowerCase(Locale.ROOT).equals(BEARER_SCHEME)) { + updatedHeaders.put(AUTHORIZATION, getBearerValue(credential)); + return new PayloadAndHeaders(payload, updatedHeaders); + } + } else if (securityScheme instanceof OAuth2SecurityScheme + || securityScheme instanceof OpenIdConnectSecurityScheme) { + updatedHeaders.put(AUTHORIZATION, getBearerValue(credential)); + return new PayloadAndHeaders(payload, updatedHeaders); + } else if (securityScheme instanceof APIKeySecurityScheme apiKeySecurityScheme) { + updatedHeaders.put(apiKeySecurityScheme.getName(), credential); + return new PayloadAndHeaders(payload, updatedHeaders); + } + } + } + } + return new PayloadAndHeaders(payload, updatedHeaders); + } + + private static String getBearerValue(String credential) { + return BEARER + credential; + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService.java new file mode 100644 index 000000000..8c8e20fd1 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/CredentialService.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.jspecify.annotations.Nullable; + +/** + * Used to retrieve credentials. + */ +public interface CredentialService { + + /** + * Retrieves a credential (e.g., token) for a security scheme. + * + * @param securitySchemeName the name of the security scheme + * @param clientCallContext the client call context, which may be {@code null}. + * @return the credential or {@code null} if the credential could not be retrieved + */ + @Nullable String getCredential(String securitySchemeName, @Nullable ClientCallContext clientCallContext); +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService.java new file mode 100644 index 000000000..deb59c4db --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/InMemoryContextCredentialService.java @@ -0,0 +1,55 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.jspecify.annotations.Nullable; + +/** + * A simple in-memory store for session-keyed credentials. + * This class uses the 'sessionId' from the {@code ClientCallContext} state to + * store and retrieve credentials + */ +public class InMemoryContextCredentialService implements CredentialService { + + private static final String SESSION_ID = "sessionId"; + + // maps a sessionId to a map of security scheme names to credentials + private final ConcurrentMap> credentialStore; + + public InMemoryContextCredentialService() { + credentialStore = new ConcurrentHashMap<>(); + } + + @Override + public @Nullable String getCredential(String securitySchemeName, + @Nullable ClientCallContext clientCallContext) { + if (clientCallContext == null || !clientCallContext.getState().containsKey(SESSION_ID)) { + // no credential to retrieve + return null; + } + + Object sessionIdObj = clientCallContext.getState().get(SESSION_ID); + if (! (sessionIdObj instanceof String sessionId)) { + return null; + } + Map sessionCredentials = credentialStore.get(sessionId); + if (sessionCredentials == null) { + return null; + } + return sessionCredentials.get(securitySchemeName); + } + + /** + * Method to populate the in-memory credential service. + * + * @param sessionId the session ID + * @param securitySchemeName the name of the security scheme + * @param credential the credential string + */ + public void setCredential(String sessionId, String securitySchemeName, String credential) { + credentialStore.computeIfAbsent(sessionId, k -> new ConcurrentHashMap<>()).put(securitySchemeName, credential); + } +} diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java new file mode 100644 index 000000000..d9805799c --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java new file mode 100644 index 000000000..bda43ec7b --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java new file mode 100644 index 000000000..850736146 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/main/java/org/a2aproject/sdk/compat03/client/transport/spi/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.transport.spi; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptorTest.java b/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptorTest.java new file mode 100644 index 000000000..b823f5ba9 --- /dev/null +++ b/compat-0.3/client/transport/spi/src/test/java/org/a2aproject/sdk/compat03/client/transport/spi/interceptors/auth/AuthInterceptorTest.java @@ -0,0 +1,328 @@ +package org.a2aproject.sdk.compat03.client.transport.spi.interceptors.auth; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallContext; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.ClientCallInterceptor; +import org.a2aproject.sdk.compat03.client.transport.spi.interceptors.PayloadAndHeaders; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuthFlows; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme; +import org.a2aproject.sdk.compat03.spec.SecurityScheme; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class AuthInterceptorTest { + + private InMemoryContextCredentialService credentialStore; + private AuthInterceptor authInterceptor; + + @BeforeEach + void setUp() { + credentialStore = new InMemoryContextCredentialService(); + authInterceptor = new AuthInterceptor(credentialStore); + } + + private static class HeaderInterceptor extends ClientCallInterceptor { + private final String headerName; + private final String headerValue; + + public HeaderInterceptor(String headerName, String headerValue) { + this.headerName = headerName; + this.headerValue = headerValue; + } + + @Override + public PayloadAndHeaders intercept(String methodName, Object payload, Map headers, + AgentCard agentCard, ClientCallContext clientCallContext) { + Map updatedHeaders = new HashMap<>(headers); + updatedHeaders.put(headerName, headerValue); + return new PayloadAndHeaders(payload, updatedHeaders); + } + } + + private static class AuthTestCase { + final String url; + final String sessionId; + final String schemeName; + final String credential; + final SecurityScheme securityScheme; + final String expectedHeaderKey; + final String expectedHeaderValue; + + AuthTestCase(String url, String sessionId, String schemeName, String credential, + SecurityScheme securityScheme, String expectedHeaderKey, String expectedHeaderValue) { + this.url = url; + this.sessionId = sessionId; + this.schemeName = schemeName; + this.credential = credential; + this.securityScheme = securityScheme; + this.expectedHeaderKey = expectedHeaderKey; + this.expectedHeaderValue = expectedHeaderValue; + } + } + + @Test + public void testAPIKeySecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + APIKeySecurityScheme.API_KEY, + "secret-api-key", + new APIKeySecurityScheme("header", "x-api-key", "API Key authentication"), + "x-api-key", + "secret-api-key" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testOAuth2SecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + OAuth2SecurityScheme.OAUTH2, + "secret-oauth-access-token", + new OAuth2SecurityScheme(new OAuthFlows.Builder().build(), "OAuth2 authentication", null), + "Authorization", + "Bearer secret-oauth-access-token" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testOidcSecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + OpenIdConnectSecurityScheme.OPENID_CONNECT, + "secret-oidc-id-token", + new OpenIdConnectSecurityScheme("http://provider.com/.well-known/openid-configuration", "OIDC authentication"), + "Authorization", + "Bearer secret-oidc-id-token" + ); + testSecurityScheme(authTestCase); + } + + @Test + public void testBearerSecurityScheme() { + AuthTestCase authTestCase = new AuthTestCase( + "http://agent.com/rpc", + "session-id", + "bearer", + "bearer-token-123", + new HTTPAuthSecurityScheme(null, "bearer", "Bearer token authentication"), + "Authorization", + "Bearer bearer-token-123" + ); + testSecurityScheme(authTestCase); + } + + private void testSecurityScheme(AuthTestCase authTestCase) { + credentialStore.setCredential(authTestCase.sessionId, authTestCase.schemeName, authTestCase.credential); + + AgentCard agentCard = createAgentCard(authTestCase.schemeName, authTestCase.securityScheme); + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext context = new ClientCallContext(Map.of("sessionId", authTestCase.sessionId), Map.of()); + + PayloadAndHeaders result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(authTestCase.expectedHeaderValue, result.getHeaders().get(authTestCase.expectedHeaderKey)); + } + + @Test + void testAuthInterceptorWithoutAgentCard() { + Map requestPayload = Map.of("foo", "bar"); + Map headers = Map.of("foo", "bar"); + + PayloadAndHeaders result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + null, // no agent card + new ClientCallContext(Map.of(), Map.of()) + ); + + // should be unchanged + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + @Test + void testInMemoryContextCredentialStore() { + String sessionId = "session-id"; + String schemeName = "test-scheme"; + String credential = "test-token"; + + credentialStore.setCredential(sessionId, schemeName, credential); + ClientCallContext context = new ClientCallContext(Map.of("sessionId", sessionId), Map.of()); + String retrievedCredential = credentialStore.getCredential(schemeName, context); + assertEquals(credential, retrievedCredential); + + // wrong session ID + ClientCallContext wrongContext = new ClientCallContext(Map.of("sessionId", "wrong-session"), Map.of()); + retrievedCredential = credentialStore.getCredential(schemeName, wrongContext); + assertNull(retrievedCredential); + + retrievedCredential = credentialStore.getCredential(schemeName, null); + assertNull(retrievedCredential); + + // no session ID in context + ClientCallContext emptyContext = new ClientCallContext(Map.of(), Map.of()); + retrievedCredential = credentialStore.getCredential(schemeName, emptyContext); + assertNull(retrievedCredential); + + String newCredential = "new-token"; + credentialStore.setCredential(sessionId, schemeName, newCredential); + retrievedCredential = credentialStore.getCredential(schemeName, context); + assertEquals(newCredential, retrievedCredential); + } + + @Test + void testCustomInterceptor() { + String headerName = "X-Test-Header"; + String headerValue = "Test-Value-123"; + HeaderInterceptor interceptor = new HeaderInterceptor(headerName, headerValue); + + Map payload = Map.of("test", "payload"); + Map headers = Map.of(); + + PayloadAndHeaders result = interceptor.intercept( + "message/send", + payload, + headers, + null, + null + ); + + assertEquals(payload, result.getPayload()); + assertEquals(headerValue, result.getHeaders().get(headerName)); + } + + @Test + void testAvailableSecuritySchemeNotInAgentCardSecuritySchemes() { + String schemeName = "missing"; + String sessionId = "session-id"; + String credential = "dummy-token"; + + credentialStore.setCredential(sessionId, schemeName, credential); + + // Create agent card with security requirement but no scheme definition + AgentCard agentCard = new AgentCard.Builder() + .name("missing") + .description("Uses missing scheme definition") + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(List.of(Map.of(schemeName, List.of()))) + .securitySchemes(Map.of()) // no security schemes + .build(); + + Map requestPayload = Map.of("foo", "bar"); + Map headers = Map.of("fizz", "buzz"); + ClientCallContext context = new ClientCallContext(Map.of("sessionId", sessionId), Map.of()); + + PayloadAndHeaders result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + @Test + void testNoCredentialAvailable() { + String schemeName = "apikey"; + SecurityScheme securityScheme = new APIKeySecurityScheme("header", "X-API-Key", "API Key authentication"); + AgentCard agentCard = createAgentCard(schemeName, securityScheme); + + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext context = new ClientCallContext(Map.of("sessionId", "session-id"), Map.of()); + + PayloadAndHeaders result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); // headers should be unchanged + } + + @Test + void testNoAgentCardSecuritySpecified() { + // Arrange + AgentCard agentCard = new AgentCard.Builder() + .name("nosecuritybot") + .description("A bot with no security requirements") + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(null) // no security info + .build(); + + Map requestPayload = Map.of("test", "payload"); + Map headers = Map.of(); + ClientCallContext context = new ClientCallContext(Map.of("sessionId", "session-id"), Map.of()); + + PayloadAndHeaders result = authInterceptor.intercept( + "message/send", + requestPayload, + headers, + agentCard, + context + ); + + assertEquals(requestPayload, result.getPayload()); + assertEquals(headers, result.getHeaders()); + } + + /** + * Helper method to create an AgentCard with specified security scheme. + */ + private AgentCard createAgentCard(String schemeName, SecurityScheme securityScheme) { + return new AgentCard.Builder() + .name(schemeName + "bot") + .description("A bot that uses " + schemeName) + .url("http://agent.com/rpc") + .version("1.0") + .capabilities(new AgentCapabilities.Builder().build()) + .defaultInputModes(List.of("text")) + .defaultOutputModes(List.of("text")) + .skills(List.of()) + .security(List.of(Map.of(schemeName, List.of()))) + .securitySchemes(Map.of(schemeName, securityScheme)) + .build(); + } +} diff --git a/compat-0.3/http-client/pom.xml b/compat-0.3/http-client/pom.xml new file mode 100644 index 000000000..e6aadc18f --- /dev/null +++ b/compat-0.3/http-client/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-http-client + + jar + + Java SDK A2A Compat 0.3 HTTP Client + Java SDK for the Agent2Agent Protocol (A2A) - HTTP Client (0.3 compat) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + + org.junit.jupiter + junit-jupiter-api + test + + + + org.mock-server + mockserver-netty + test + + + + diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver.java new file mode 100644 index 000000000..73b0f67d3 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolver.java @@ -0,0 +1,113 @@ +package org.a2aproject.sdk.compat03.client.http; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Map; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.jspecify.annotations.Nullable; + +public class A2ACardResolver { + private final A2AHttpClient httpClient; + private final String url; + private final @Nullable Map authHeaders; + + private static final String DEFAULT_AGENT_CARD_PATH = "/.well-known/agent-card.json"; + + /** + * Get the agent card for an A2A agent. + * The {@code JdkA2AHttpClient} will be used to fetch the agent card. + * + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @throws A2AClientError if the URL for the agent is invalid + */ + public A2ACardResolver(String baseUrl) throws A2AClientError { + this(new JdkA2AHttpClient(), baseUrl, null, null); + } + + /** + * Constructs an A2ACardResolver with a specific HTTP client and base URL. + * + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @throws A2AClientError if the URL for the agent is invalid + */ + public A2ACardResolver(A2AHttpClient httpClient, String baseUrl) throws A2AClientError { + this(httpClient, baseUrl, null, null); + } + + /** + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @param agentCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @throws A2AClientError if the URL for the agent is invalid + */ + public A2ACardResolver(A2AHttpClient httpClient, String baseUrl, String agentCardPath) throws A2AClientError { + this(httpClient, baseUrl, agentCardPath, null); + } + + /** + * @param httpClient the http client to use + * @param baseUrl the base URL for the agent whose agent card we want to retrieve + * @param agentCardPath optional path to the agent card endpoint relative to the base + * agent URL, defaults to ".well-known/agent-card.json" + * @param authHeaders the HTTP authentication headers to use. May be {@code null} + * @throws A2AClientError if the URL for the agent is invalid + */ + public A2ACardResolver(A2AHttpClient httpClient, String baseUrl, @Nullable String agentCardPath, + @Nullable Map authHeaders) throws A2AClientError { + this.httpClient = httpClient; + String effectiveAgentCardPath = agentCardPath == null || agentCardPath.isEmpty() ? DEFAULT_AGENT_CARD_PATH : agentCardPath; + try { + this.url = new URI(baseUrl).resolve(effectiveAgentCardPath).toString(); + } catch (URISyntaxException e) { + throw new A2AClientError("Invalid agent URL", e); + } + this.authHeaders = authHeaders; + } + + /** + * Get the agent card for the configured A2A agent. + * + * @return the agent card + * @throws A2AClientError If an HTTP error occurs fetching the card + * @throws A2AClientJSONError If the response body cannot be decoded as JSON or validated against the AgentCard schema + */ + public AgentCard getAgentCard() throws A2AClientError, A2AClientJSONError { + A2AHttpClient.GetBuilder builder = httpClient.createGet() + .url(url) + .addHeader("Content-Type", "application/json"); + + if (authHeaders != null) { + for (Map.Entry entry : authHeaders.entrySet()) { + builder.addHeader(entry.getKey(), entry.getValue()); + } + } + + String body; + try { + A2AHttpResponse response = builder.get(); + if (!response.success()) { + throw new A2AClientError("Failed to obtain agent card: " + response.status()); + } + body = response.body(); + } catch (IOException | InterruptedException e) { + throw new A2AClientError("Failed to obtain agent card", e); + } + + try { + return JsonUtil.fromJson(body, AgentCard.class); + } catch (JsonProcessingException e) { + throw new A2AClientJSONError("Could not unmarshal agent card response", e); + } + + } + + +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient.java new file mode 100644 index 000000000..cc6cbeb83 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpClient.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.client.http; + +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +public interface A2AHttpClient { + + GetBuilder createGet(); + + PostBuilder createPost(); + + DeleteBuilder createDelete(); + + interface Builder> { + T url(String s); + T addHeaders(Map headers); + T addHeader(String name, String value); + } + + interface GetBuilder extends Builder { + A2AHttpResponse get() throws IOException, InterruptedException; + CompletableFuture getAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException; + } + + interface PostBuilder extends Builder { + PostBuilder body(String body); + A2AHttpResponse post() throws IOException, InterruptedException; + CompletableFuture postAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException; + } + + interface DeleteBuilder extends Builder { + A2AHttpResponse delete() throws IOException, InterruptedException; + } +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse.java new file mode 100644 index 000000000..5953b8252 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/A2AHttpResponse.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.client.http; + +public interface A2AHttpResponse { + int status(); + + boolean success(); + + String body(); +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient.java new file mode 100644 index 000000000..7952de395 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/JdkA2AHttpClient.java @@ -0,0 +1,316 @@ +package org.a2aproject.sdk.compat03.client.http; + +import static java.net.HttpURLConnection.HTTP_FORBIDDEN; +import static java.net.HttpURLConnection.HTTP_MULT_CHOICE; +import static java.net.HttpURLConnection.HTTP_OK; +import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.net.http.HttpResponse.BodyHandlers; +import java.net.http.HttpResponse.BodySubscribers; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; +import java.util.function.Consumer; +import org.jspecify.annotations.Nullable; + +import org.a2aproject.sdk.common.A2AErrorMessages; + +public class JdkA2AHttpClient implements A2AHttpClient { + + private final HttpClient httpClient; + + public JdkA2AHttpClient() { + httpClient = HttpClient.newBuilder() + .version(HttpClient.Version.HTTP_2) + .followRedirects(HttpClient.Redirect.NORMAL) + .build(); + } + + @Override + public GetBuilder createGet() { + return new JdkGetBuilder(); + } + + @Override + public PostBuilder createPost() { + return new JdkPostBuilder(); + } + + @Override + public DeleteBuilder createDelete() { + return new JdkDeleteBuilder(); + } + + private abstract class JdkBuilder> implements Builder { + private String url = ""; + private Map headers = new HashMap<>(); + + @Override + public T url(String url) { + this.url = url; + return self(); + } + + @Override + public T addHeader(String name, String value) { + headers.put(name, value); + return self(); + } + + @Override + public T addHeaders(Map headers) { + if(headers != null && ! headers.isEmpty()) { + for (Map.Entry entry : headers.entrySet()) { + addHeader(entry.getKey(), entry.getValue()); + } + } + return self(); + } + + @SuppressWarnings("unchecked") + T self() { + return (T) this; + } + + protected HttpRequest.Builder createRequestBuilder() throws IOException { + HttpRequest.Builder builder = HttpRequest.newBuilder() + .uri(URI.create(url)); + for (Map.Entry headerEntry : headers.entrySet()) { + builder.header(headerEntry.getKey(), headerEntry.getValue()); + } + return builder; + } + + protected CompletableFuture asyncRequest( + HttpRequest request, + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable + ) { + Flow.Subscriber subscriber = new Flow.Subscriber() { + private Flow.@Nullable Subscription subscription; + private volatile boolean errorRaised = false; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + this.subscription.request(1); + } + + @Override + public void onNext(String item) { + // SSE messages sometimes start with "data:". Strip that off + if (item != null && item.startsWith("data:")) { + item = item.substring(5).trim(); + if (!item.isEmpty()) { + messageConsumer.accept(item); + } + } + if (subscription != null) { + subscription.request(1); + } + } + + @Override + public void onError(Throwable throwable) { + if (!errorRaised) { + errorRaised = true; + errorConsumer.accept(throwable); + } + if (subscription != null) { + subscription.cancel(); + } + } + + @Override + public void onComplete() { + if (!errorRaised) { + completeRunnable.run(); + } + if (subscription != null) { + subscription.cancel(); + } + } + }; + + // Create a custom body handler that checks status before processing body + BodyHandler bodyHandler = responseInfo -> { + // Check for authentication/authorization errors only + if (responseInfo.statusCode() == HTTP_UNAUTHORIZED || responseInfo.statusCode() == HTTP_FORBIDDEN) { + final String errorMessage; + if (responseInfo.statusCode() == HTTP_UNAUTHORIZED) { + errorMessage = A2AErrorMessages.AUTHENTICATION_FAILED; + } else { + errorMessage = A2AErrorMessages.AUTHORIZATION_FAILED; + } + // Return a body subscriber that immediately signals error + return BodySubscribers.fromSubscriber(new Flow.Subscriber>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriber.onError(new IOException(errorMessage)); + } + + @Override + public void onNext(List item) { + // Should not be called + } + + @Override + public void onError(Throwable throwable) { + // Should not be called + } + + @Override + public void onComplete() { + // Should not be called + } + }); + } else { + // For all other status codes (including other errors), proceed with normal line subscriber + return BodyHandlers.fromLineSubscriber(subscriber).apply(responseInfo); + } + }; + + // Send the response async, and let the subscriber handle the lines. + return httpClient.sendAsync(request, bodyHandler) + .thenAccept(response -> { + // Handle non-authentication/non-authorization errors here + if (!isSuccessStatus(response.statusCode()) && + response.statusCode() != HTTP_UNAUTHORIZED && + response.statusCode() != HTTP_FORBIDDEN) { + subscriber.onError(new IOException("Request failed with status " + response.statusCode() + ":" + response.body())); + } + }) + .exceptionally(throwable -> { + // Handle network errors (timeouts, connection failures, etc.) + subscriber.onError(throwable); + return null; + }); + } + } + + private class JdkGetBuilder extends JdkBuilder implements A2AHttpClient.GetBuilder { + + private HttpRequest.Builder createRequestBuilder(boolean SSE) throws IOException { + HttpRequest.Builder builder = super.createRequestBuilder().GET(); + if (SSE) { + builder.header("Accept", "text/event-stream"); + } + return builder; + } + + @Override + public A2AHttpResponse get() throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(false) + .build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + return new JdkHttpResponse(response); + } + + @Override + public CompletableFuture getAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(true) + .build(); + return super.asyncRequest(request, messageConsumer, errorConsumer, completeRunnable); + } + + } + + private class JdkDeleteBuilder extends JdkBuilder implements A2AHttpClient.DeleteBuilder { + + @Override + public A2AHttpResponse delete() throws IOException, InterruptedException { + HttpRequest request = super.createRequestBuilder().DELETE().build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + return new JdkHttpResponse(response); + } + + } + + private class JdkPostBuilder extends JdkBuilder implements A2AHttpClient.PostBuilder { + String body = ""; + + @Override + public PostBuilder body(String body) { + this.body = body; + return self(); + } + + private HttpRequest.Builder createRequestBuilder(boolean SSE) throws IOException { + HttpRequest.Builder builder = super.createRequestBuilder() + .POST(HttpRequest.BodyPublishers.ofString(body, StandardCharsets.UTF_8)); + if (SSE) { + builder.header("Accept", "text/event-stream"); + } + return builder; + } + + @Override + public A2AHttpResponse post() throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(false) + .POST(HttpRequest.BodyPublishers.ofString(body, StandardCharsets.UTF_8)) + .build(); + HttpResponse response = + httpClient.send(request, BodyHandlers.ofString(StandardCharsets.UTF_8)); + + if (response.statusCode() == HTTP_UNAUTHORIZED) { + throw new IOException(A2AErrorMessages.AUTHENTICATION_FAILED); + } else if (response.statusCode() == HTTP_FORBIDDEN) { + throw new IOException(A2AErrorMessages.AUTHORIZATION_FAILED); + } + + return new JdkHttpResponse(response); + } + + @Override + public CompletableFuture postAsyncSSE( + Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) throws IOException, InterruptedException { + HttpRequest request = createRequestBuilder(true) + .build(); + return super.asyncRequest(request, messageConsumer, errorConsumer, completeRunnable); + } + } + + private record JdkHttpResponse(HttpResponse response) implements A2AHttpResponse { + + @Override + public int status() { + return response.statusCode(); + } + + @Override + public boolean success() {// Send the request and get the response + return success(response); + } + + static boolean success(HttpResponse response) { + return response.statusCode() >= HTTP_OK && response.statusCode() < HTTP_MULT_CHOICE; + } + + @Override + public String body() { + return response.body(); + } + } + + private static boolean isSuccessStatus(int statusCode) { + return statusCode >= HTTP_OK && statusCode < HTTP_MULT_CHOICE; + } +} diff --git a/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java new file mode 100644 index 000000000..035bf5a62 --- /dev/null +++ b/compat-0.3/http-client/src/main/java/org/a2aproject/sdk/compat03/client/http/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.client.http; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolverTest.java b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolverTest.java new file mode 100644 index 000000000..1b478675e --- /dev/null +++ b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/A2ACardResolverTest.java @@ -0,0 +1,177 @@ +package org.a2aproject.sdk.compat03.client.http; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.spec.A2AClientError; +import org.a2aproject.sdk.compat03.spec.A2AClientJSONError; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import java.util.Map; +import org.junit.jupiter.api.Test; + +public class A2ACardResolverTest { + + private static final String AGENT_CARD_PATH = "/.well-known/agent-card.json"; + + @Test + public void testConstructorStripsSlashes() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = JsonMessages.AGENT_CARD; + + A2ACardResolver resolver = new A2ACardResolver(client, "http://example.com/"); + AgentCard card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + + resolver = new A2ACardResolver(client, "http://example.com"); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl with trailing slash, agentCardParth with leading slash + resolver = new A2ACardResolver(client, "http://example.com/", AGENT_CARD_PATH); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl without trailing slash, agentCardPath with leading slash + resolver = new A2ACardResolver(client, "http://example.com", AGENT_CARD_PATH); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl with trailing slash, agentCardPath without leading slash + resolver = new A2ACardResolver(client, "http://example.com/", AGENT_CARD_PATH.substring(1)); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + + // baseUrl without trailing slash, agentCardPath without leading slash + resolver = new A2ACardResolver(client, "http://example.com", AGENT_CARD_PATH.substring(1)); + card = resolver.getAgentCard(); + + assertEquals("http://example.com" + AGENT_CARD_PATH, client.url); + } + + + @Test + public void testGetAgentCardSuccess() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = JsonMessages.AGENT_CARD; + + A2ACardResolver resolver = new A2ACardResolver(client, "http://example.com/"); + AgentCard card = resolver.getAgentCard(); + + AgentCard expectedCard = JsonUtil.fromJson(JsonMessages.AGENT_CARD, AgentCard.class); + String expected = JsonUtil.toJson(expectedCard); + + String requestCardString = JsonUtil.toJson(card); + assertEquals(expected, requestCardString); + } + + @Test + public void testGetAgentCardJsonDecodeError() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.body = "X" + JsonMessages.AGENT_CARD; + + A2ACardResolver resolver = new A2ACardResolver(client, "http://example.com/"); + + boolean success = false; + try { + AgentCard card = resolver.getAgentCard(); + success = true; + } catch (A2AClientJSONError expected) { + } + assertFalse(success); + } + + + @Test + public void testGetAgentCardRequestError() throws Exception { + TestHttpClient client = new TestHttpClient(); + client.status = 503; + + A2ACardResolver resolver = new A2ACardResolver(client, "http://example.com/"); + + String msg = null; + try { + AgentCard card = resolver.getAgentCard(); + } catch (A2AClientError expected) { + msg = expected.getMessage(); + } + assertTrue(msg.contains("503")); + } + + private static class TestHttpClient implements A2AHttpClient { + int status = 200; + String body; + String url; + + @Override + public GetBuilder createGet() { + return new TestGetBuilder(); + } + + @Override + public PostBuilder createPost() { + return null; + } + + @Override + public DeleteBuilder createDelete() { + return null; + } + + class TestGetBuilder implements A2AHttpClient.GetBuilder { + + @Override + public A2AHttpResponse get() throws IOException, InterruptedException { + return new A2AHttpResponse() { + @Override + public int status() { + return status; + } + + @Override + public boolean success() { + return status == 200; + } + + @Override + public String body() { + return body; + } + }; + } + + @Override + public CompletableFuture getAsyncSSE(Consumer messageConsumer, Consumer errorConsumer, Runnable completeRunnable) throws IOException, InterruptedException { + return null; + } + + @Override + public GetBuilder url(String s) { + url = s; + return this; + } + + @Override + public GetBuilder addHeader(String name, String value) { + return this; + } + + @Override + public GetBuilder addHeaders(Map headers) { + return this; + } + } + } + +} diff --git a/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages.java b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages.java new file mode 100644 index 000000000..dfffee858 --- /dev/null +++ b/compat-0.3/http-client/src/test/java/org/a2aproject/sdk/compat03/client/http/JsonMessages.java @@ -0,0 +1,164 @@ +package org.a2aproject.sdk.compat03.client.http; + +/** + * Request and response messages used by the tests. These have been created following examples from + * the A2A sample messages. + */ +public class JsonMessages { + + static final String AGENT_CARD = """ + { + "protocolVersion": "0.2.9", + "name": "GeoSpatial Route Planner Agent", + "description": "Provides advanced route planning, traffic analysis, and custom map generation services. This agent can calculate optimal routes, estimate travel times considering real-time traffic, and create personalized maps with points of interest.", + "url": "https://georoute-agent.example.com/a2a/v1", + "preferredTransport": "JSONRPC", + "additionalInterfaces" : [ + {"url": "https://georoute-agent.example.com/a2a/v1", "transport": "JSONRPC"}, + {"url": "https://georoute-agent.example.com/a2a/grpc", "transport": "GRPC"}, + {"url": "https://georoute-agent.example.com/a2a/json", "transport": "HTTP+JSON"} + ], + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + } + ], + "supportsAuthenticatedExtendedCard": true, + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + static final String AUTHENTICATION_EXTENDED_AGENT_CARD = """ + { + "name": "GeoSpatial Route Planner Agent Extended", + "description": "Extended description", + "url": "https://georoute-agent.example.com/a2a/v1", + "provider": { + "organization": "Example Geo Services Inc.", + "url": "https://www.examplegeoservices.com" + }, + "iconUrl": "https://georoute-agent.example.com/icon.png", + "version": "1.2.0", + "documentationUrl": "https://docs.examplegeoservices.com/georoute-agent/api", + "capabilities": { + "streaming": true, + "pushNotifications": true, + "stateTransitionHistory": false + }, + "securitySchemes": { + "google": { + "type": "openIdConnect", + "openIdConnectUrl": "https://accounts.google.com/.well-known/openid-configuration" + } + }, + "security": [{ "google": ["openid", "profile", "email"] }], + "defaultInputModes": ["application/json", "text/plain"], + "defaultOutputModes": ["application/json", "image/png"], + "skills": [ + { + "id": "route-optimizer-traffic", + "name": "Traffic-Aware Route Optimizer", + "description": "Calculates the optimal driving route between two or more locations, taking into account real-time traffic conditions, road closures, and user preferences (e.g., avoid tolls, prefer highways).", + "tags": ["maps", "routing", "navigation", "directions", "traffic"], + "examples": [ + "Plan a route from '1600 Amphitheatre Parkway, Mountain View, CA' to 'San Francisco International Airport' avoiding tolls.", + "{\\"origin\\": {\\"lat\\": 37.422, \\"lng\\": -122.084}, \\"destination\\": {\\"lat\\": 37.7749, \\"lng\\": -122.4194}, \\"preferences\\": [\\"avoid_ferries\\"]}" + ], + "inputModes": ["application/json", "text/plain"], + "outputModes": [ + "application/json", + "application/vnd.geo+json", + "text/html" + ] + }, + { + "id": "custom-map-generator", + "name": "Personalized Map Generator", + "description": "Creates custom map images or interactive map views based on user-defined points of interest, routes, and style preferences. Can overlay data layers.", + "tags": ["maps", "customization", "visualization", "cartography"], + "examples": [ + "Generate a map of my upcoming road trip with all planned stops highlighted.", + "Show me a map visualizing all coffee shops within a 1-mile radius of my current location." + ], + "inputModes": ["application/json"], + "outputModes": [ + "image/png", + "image/jpeg", + "application/json", + "text/html" + ] + }, + { + "id": "skill-extended", + "name": "Extended Skill", + "description": "This is an extended skill.", + "tags": ["extended"] + } + ], + "supportsAuthenticatedExtendedCard": true, + "protocolVersion": "0.2.9", + "signatures": [ + { + "protected": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpPU0UiLCJraWQiOiJrZXktMSIsImprdSI6Imh0dHBzOi8vZXhhbXBsZS5jb20vYWdlbnQvandrcy5qc29uIn0", + "signature": "QFdkNLNszlGj3z3u0YQGt_T9LixY3qtdQpZmsTdDHDe3fXV9y9-B3m2-XgCpzuhiLt8E0tV6HXoZKHv4GtHgKQ" + } + ] + }"""; + + +} \ No newline at end of file diff --git a/compat-0.3/pom.xml b/compat-0.3/pom.xml new file mode 100644 index 000000000..40409e722 --- /dev/null +++ b/compat-0.3/pom.xml @@ -0,0 +1,143 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-parent + 1.0.0.Beta1-SNAPSHOT + + + a2a-java-sdk-compat-0.3-parent + pom + + Java SDK A2A Compat 0.3 Parent + A2A Protocol v0.3 backward compatibility layer for v1.0 SDK + + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-http-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-spi + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + ${project.version} + + + ${project.groupId} + a2a-compat-0.3-tck-server + ${project.version} + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + + + + + + + spec + spec-grpc + + + http-client + + + server-conversion + + + client/base + client/transport/spi + client/transport/jsonrpc + client/transport/grpc + client/transport/rest + + + transport/jsonrpc + transport/grpc + transport/rest + + + reference/common + reference/jsonrpc + reference/grpc + reference/rest + + + tck + + + diff --git a/compat-0.3/reference/common/pom.xml b/compat-0.3/reference/common/pom.xml new file mode 100644 index 000000000..c992e6d5c --- /dev/null +++ b/compat-0.3/reference/common/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-reference-common + + jar + + Java A2A Compat 0.3 Reference Server: Common + Java SDK for the Agent2Agent Protocol (A2A) - Common classes for A2A Reference Servers (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-tests-server-common + provided + + + ${project.groupId} + a2a-java-sdk-tests-server-common + test-jar + test + + + io.quarkus + quarkus-reactive-routes + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + org.slf4j + slf4j-api + + + ${project.groupId} + a2a-java-sdk-microprofile-config + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-rest-client-jackson + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.rest-assured + rest-assured + test + + + \ No newline at end of file diff --git a/compat-0.3/reference/common/src/main/java/org/a2aproject/sdk/compat03/server/common/quarkus/DefaultProducers.java b/compat-0.3/reference/common/src/main/java/org/a2aproject/sdk/compat03/server/common/quarkus/DefaultProducers.java new file mode 100644 index 000000000..3a4ffaf8c --- /dev/null +++ b/compat-0.3/reference/common/src/main/java/org/a2aproject/sdk/compat03/server/common/quarkus/DefaultProducers.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.server.common.quarkus; + +// TODO: Uncomment when server-common is ported +// This file has been temporarily stubbed out because it depends on server-common classes +// that haven't been ported yet. See the original at: +// /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/common/src/main/java/io/a2a/server/common/quarkus/DefaultProducers.java + +/** + * Placeholder stub for DefaultProducers. + * The full implementation is commented out until server-common module is ported. + */ +public class DefaultProducers { + // Full implementation commented out - awaiting server-common port +} diff --git a/compat-0.3/reference/grpc/pom.xml b/compat-0.3/reference/grpc/pom.xml new file mode 100644 index 000000000..bc23f65a3 --- /dev/null +++ b/compat-0.3/reference/grpc/pom.xml @@ -0,0 +1,98 @@ + + + 4.0.0 + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + + a2a-java-sdk-compat-0.3-reference-grpc + Java A2A Compat 0.3 Reference Server: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - A2A gRPC Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + + + ${project.groupId} + a2a-java-sdk-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-grpc + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-tests-server-common + provided + + + ${project.groupId} + a2a-java-sdk-tests-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-grpc + test + + + + io.quarkus + quarkus-grpc + + + io.quarkus + quarkus-rest + test + + + io.quarkus + quarkus-junit5 + test + + + org.assertj + assertj-core + 3.25.3 + test + + + com.google.api.grpc + proto-google-common-protos + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + io.rest-assured + rest-assured + test + + + + \ No newline at end of file diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor.java new file mode 100644 index 000000000..6d94b2674 --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2AExtensionsInterceptor.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import jakarta.enterprise.context.ApplicationScoped; +import io.grpc.Context; +import io.grpc.Contexts; +import io.grpc.Metadata; +import io.grpc.ServerCall; +import io.grpc.ServerCallHandler; +import io.grpc.ServerInterceptor; +import org.a2aproject.sdk.common.A2AHeaders; +import org.a2aproject.sdk.compat03.common.A2ACompat03Headers; +import org.a2aproject.sdk.compat03.transport.grpc.context.GrpcContextKeys; + +/** + * gRPC server interceptor that captures request metadata and context information, + * providing equivalent functionality to Python's grpc.aio.ServicerContext. + * + * This interceptor: + * - Extracts A2A extension headers from incoming requests + * - Captures ServerCall and Metadata for rich context access + * - Stores context information in gRPC Context for service method access + * - Provides proper equivalence to Python's ServicerContext + */ +@ApplicationScoped +public class A2AExtensionsInterceptor implements ServerInterceptor { + + + @Override + public ServerCall.Listener interceptCall( + ServerCall serverCall, + Metadata metadata, + ServerCallHandler serverCallHandler) { + + // Extract A2A extensions header + Metadata.Key extensionsKey = + Metadata.Key.of(A2ACompat03Headers.X_A2A_EXTENSIONS, Metadata.ASCII_STRING_MARSHALLER); + String extensions = metadata.get(extensionsKey); + + // Create enhanced context with rich information (equivalent to Python's ServicerContext) + Context context = Context.current() + // Store complete metadata for full header access + .withValue(GrpcContextKeys.METADATA_KEY, metadata) + // Store method name (equivalent to Python's context.method()) + .withValue(GrpcContextKeys.METHOD_NAME_KEY, serverCall.getMethodDescriptor().getFullMethodName()) + // Store peer information for client connection details + .withValue(GrpcContextKeys.PEER_INFO_KEY, getPeerInfo(serverCall)); + + // Store A2A extensions if present + if (extensions != null) { + context = context.withValue(GrpcContextKeys.EXTENSIONS_HEADER_KEY, extensions); + } + + // Proceed with the call in the enhanced context + return Contexts.interceptCall(context, serverCall, metadata, serverCallHandler); + } + + /** + * Safely extracts peer information from the ServerCall. + * + * @param serverCall the gRPC ServerCall + * @return peer information string, or "unknown" if not available + */ + private String getPeerInfo(ServerCall serverCall) { + try { + Object remoteAddr = serverCall.getAttributes().get(io.grpc.Grpc.TRANSPORT_ATTR_REMOTE_ADDR); + return remoteAddr != null ? remoteAddr.toString() : "unknown"; + } catch (Exception e) { + return "unknown"; + } + } +} diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler.java new file mode 100644 index 000000000..16ff45ba6 --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcHandler.java @@ -0,0 +1,52 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import java.util.concurrent.Executor; + +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +import io.quarkus.grpc.GrpcService; +import io.quarkus.grpc.RegisterInterceptor; +import io.quarkus.security.Authenticated; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.transport.grpc.handler.CallContextFactory; +import org.a2aproject.sdk.compat03.transport.grpc.handler.GrpcHandler; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.util.async.Internal; + +@GrpcService +@RegisterInterceptor(A2AExtensionsInterceptor.class) +@Authenticated +public class QuarkusGrpcHandler extends GrpcHandler { + + private final AgentCard agentCard; + private final Instance callContextFactoryInstance; + private final Executor executor; + + @Inject + public QuarkusGrpcHandler(@PublicAgentCard AgentCard agentCard, + Convert03To10RequestHandler requestHandler, + Instance callContextFactoryInstance, + @Internal Executor executor) { + this.agentCard = agentCard; + this.callContextFactoryInstance = callContextFactoryInstance; + this.executor = executor; + setRequestHandler(requestHandler); + } + + @Override + protected AgentCard getAgentCard() { + return agentCard; + } + + @Override + protected CallContextFactory getCallContextFactory() { + return callContextFactoryInstance.isUnsatisfied() ? null : callContextFactoryInstance.get(); + } + + @Override + protected Executor getExecutor() { + return executor; + } +} diff --git a/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata.java b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata.java new file mode 100644 index 000000000..a865ab53b --- /dev/null +++ b/compat-0.3/reference/grpc/src/main/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusGrpcTransportMetadata.java @@ -0,0 +1,11 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import org.a2aproject.sdk.server.TransportMetadata; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +public class QuarkusGrpcTransportMetadata implements TransportMetadata { + @Override + public String getTransportProtocol() { + return TransportProtocol.GRPC.asString(); + } +} diff --git a/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource.java b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource.java new file mode 100644 index 000000000..bdd94ab0e --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/A2ATestResource.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/grpc/src/test/java/io/a2a/server/grpc/quarkus/A2ATestResource.java + +/** + * Placeholder stub - awaiting server-common port. + */ +public class A2ATestResource { +} diff --git a/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpcTest.java b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpcTest.java new file mode 100644 index 000000000..6b1f399a2 --- /dev/null +++ b/compat-0.3/reference/grpc/src/test/java/org/a2aproject/sdk/compat03/server/grpc/quarkus/QuarkusA2AGrpcTest.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.server.grpc.quarkus; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/grpc/src/test/java/io/a2a/server/grpc/quarkus/QuarkusA2AGrpcTest.java + +/** + * Placeholder stub - awaiting server-common port. + */ +@Disabled("Disabled until server-common is ported") +public class QuarkusA2AGrpcTest { + + @Test + public void placeholderTest() { + // This test exists only to make the test class show up as skipped + // Full test implementation commented out - awaiting server-common port + } +} diff --git a/compat-0.3/reference/jsonrpc/pom.xml b/compat-0.3/reference/jsonrpc/pom.xml new file mode 100644 index 000000000..3779e2c28 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/pom.xml @@ -0,0 +1,95 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-reference-jsonrpc + + jar + + Java A2A Compat 0.3 Reference Server: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - A2A JSONRPC Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-jsonrpc + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-tests-server-common + provided + + + ${project.groupId} + a2a-java-sdk-tests-server-common + test-jar + test + + + io.quarkus + quarkus-reactive-routes + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + org.slf4j + slf4j-api + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-rest-client-jackson + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.rest-assured + rest-assured + test + + + org.mockito + mockito-core + test + + + org.mockito + mockito-junit-jupiter + test + + + diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes.java new file mode 100644 index 000000000..fd7ebe99b --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutes.java @@ -0,0 +1,388 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.SERVER_SENT_EVENTS; +import static org.a2aproject.sdk.compat03.transport.jsonrpc.context.JSONRPCContextKeys.HEADERS_KEY; +import static org.a2aproject.sdk.compat03.transport.jsonrpc.context.JSONRPCContextKeys.METHOD_NAME_KEY; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import io.quarkus.security.Authenticated; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.ReactiveRoutes; +import io.quarkus.vertx.web.Route; +import io.smallrye.mutiny.Multi; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.web.RoutingContext; +import org.a2aproject.sdk.compat03.common.A2ACompat03Headers; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.JSONRPCErrorResponse; +import org.a2aproject.sdk.compat03.spec.JSONRPCMessage; +import org.a2aproject.sdk.compat03.spec.JSONRPCRequest; +import org.a2aproject.sdk.compat03.spec.JSONRPCResponse; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.NonStreamingJSONRPCRequest; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.StreamingJSONRPCRequest; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import org.a2aproject.sdk.compat03.transport.jsonrpc.handler.JSONRPCHandler; +import org.a2aproject.sdk.compat03.util.Utils; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.server.extensions.A2AExtensions; +import org.a2aproject.sdk.server.util.async.Internal; + +@Singleton +public class A2AServerRoutes { + + @Inject + JSONRPCHandler jsonRpcHandler; + + // Hook so testing can wait until the MultiSseSupport is subscribed. + // Without this we get intermittent failures + private static volatile Runnable streamingMultiSseSupportSubscribedRunnable; + + @Inject + @Internal + Executor executor; + + @Inject + Instance callContextFactory; + + @Route(path = "/", methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + @Authenticated + public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) { + boolean streaming = false; + ServerCallContext context = createCallContext(rc); + JSONRPCResponse nonStreamingResponse = null; + Multi> streamingResponse = null; + JSONRPCErrorResponse error = null; + Object requestId = null; + try { + com.google.gson.JsonObject node; + try { + node = JsonParser.parseString(body).getAsJsonObject(); + } catch (Exception e) { + throw new JSONParseError(e.getMessage()); + } + + // Validate jsonrpc field + com.google.gson.JsonElement jsonrpcElement = node.get("jsonrpc"); + if (jsonrpcElement == null || !jsonrpcElement.isJsonPrimitive() + || !JSONRPCMessage.JSONRPC_VERSION.equals(jsonrpcElement.getAsString())) { + throw new InvalidRequestError("Invalid JSON-RPC request: missing or invalid 'jsonrpc' field"); + } + + // Validate id field (must be string, number, or null — not an object or array) + com.google.gson.JsonElement idElement = node.get("id"); + if (idElement != null && !idElement.isJsonNull() && !idElement.isJsonPrimitive()) { + throw new InvalidRequestError("Invalid JSON-RPC request: 'id' must be a string, number, or null"); + } + if (idElement != null && !idElement.isJsonNull() && idElement.isJsonPrimitive()) { + com.google.gson.JsonPrimitive idPrimitive = idElement.getAsJsonPrimitive(); + requestId = idPrimitive.isNumber() ? idPrimitive.getAsLong() : idPrimitive.getAsString(); + } + + // Validate method field + com.google.gson.JsonElement methodElement = node.get("method"); + if (methodElement == null || !methodElement.isJsonPrimitive()) { + throw new InvalidRequestError("Invalid JSON-RPC request: missing or invalid 'method' field"); + } + + String methodName = methodElement.getAsString(); + context.getState().put(METHOD_NAME_KEY, methodName); + + streaming = SendStreamingMessageRequest.METHOD.equals(methodName) + || TaskResubscriptionRequest.METHOD.equals(methodName); + + if (streaming) { + StreamingJSONRPCRequest request = deserializeStreamingRequest(body, methodName); + streamingResponse = processStreamingRequest(request, context); + } else { + NonStreamingJSONRPCRequest request = deserializeNonStreamingRequest(body, methodName); + nonStreamingResponse = processNonStreamingRequest(request, context); + } + } catch (JSONRPCError e) { + error = new JSONRPCErrorResponse(requestId, e); + } catch (JsonSyntaxException e) { + error = new JSONRPCErrorResponse(requestId, new JSONParseError(e.getMessage())); + } catch (Throwable t) { + error = new JSONRPCErrorResponse(requestId, new InternalError(t.getMessage())); + } finally { + if (error != null) { + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(Utils.toJsonString(error)); + } else if (streaming) { + final Multi> finalStreamingResponse = streamingResponse; + executor.execute(() -> { + MultiSseSupport.subscribeObject( + finalStreamingResponse.map(i -> (Object) i), rc); + }); + + } else { + rc.response() + .setStatusCode(200) + .putHeader(CONTENT_TYPE, APPLICATION_JSON) + .end(Utils.toJsonString(nonStreamingResponse)); + } + } + } + + /** + * /** + * Handles incoming GET requests to the agent card endpoint. + * Returns the agent card in JSON format. + * + * @return the agent card + */ + @Route(path = "/.well-known/agent-card.json", methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + public AgentCard getAgentCard() { + return jsonRpcHandler.getAgentCard(); + } + + private NonStreamingJSONRPCRequest deserializeNonStreamingRequest(String body, String methodName) { + try { + return switch (methodName) { + case GetTaskRequest.METHOD -> JsonUtil.fromJson(body, GetTaskRequest.class); + case CancelTaskRequest.METHOD -> JsonUtil.fromJson(body, CancelTaskRequest.class); + case SendMessageRequest.METHOD -> JsonUtil.fromJson(body, SendMessageRequest.class); + case SetTaskPushNotificationConfigRequest.METHOD -> JsonUtil.fromJson(body, SetTaskPushNotificationConfigRequest.class); + case GetTaskPushNotificationConfigRequest.METHOD -> JsonUtil.fromJson(body, GetTaskPushNotificationConfigRequest.class); + case ListTaskPushNotificationConfigRequest.METHOD -> JsonUtil.fromJson(body, ListTaskPushNotificationConfigRequest.class); + case DeleteTaskPushNotificationConfigRequest.METHOD -> JsonUtil.fromJson(body, DeleteTaskPushNotificationConfigRequest.class); + case GetAuthenticatedExtendedCardRequest.METHOD -> JsonUtil.fromJson(body, GetAuthenticatedExtendedCardRequest.class); + default -> throw new MethodNotFoundError(); + }; + } catch (JSONRPCError e) { + throw e; + } catch (Exception e) { + throw new InvalidParamsError(e.getMessage()); + } + } + + private StreamingJSONRPCRequest deserializeStreamingRequest(String body, String methodName) { + try { + return switch (methodName) { + case SendStreamingMessageRequest.METHOD -> JsonUtil.fromJson(body, SendStreamingMessageRequest.class); + case TaskResubscriptionRequest.METHOD -> JsonUtil.fromJson(body, TaskResubscriptionRequest.class); + default -> throw new MethodNotFoundError(); + }; + } catch (JSONRPCError e) { + throw e; + } catch (Exception e) { + throw new InvalidParamsError(e.getMessage()); + } + } + + private JSONRPCResponse processNonStreamingRequest( + NonStreamingJSONRPCRequest request, ServerCallContext context) { + if (request instanceof GetTaskRequest req) { + return jsonRpcHandler.onGetTask(req, context); + } else if (request instanceof CancelTaskRequest req) { + return jsonRpcHandler.onCancelTask(req, context); + } else if (request instanceof SetTaskPushNotificationConfigRequest req) { + return jsonRpcHandler.setPushNotificationConfig(req, context); + } else if (request instanceof GetTaskPushNotificationConfigRequest req) { + return jsonRpcHandler.getPushNotificationConfig(req, context); + } else if (request instanceof SendMessageRequest req) { + return jsonRpcHandler.onMessageSend(req, context); + } else if (request instanceof ListTaskPushNotificationConfigRequest req) { + return jsonRpcHandler.listPushNotificationConfig(req, context); + } else if (request instanceof DeleteTaskPushNotificationConfigRequest req) { + return jsonRpcHandler.deletePushNotificationConfig(req, context); + } else if (request instanceof GetAuthenticatedExtendedCardRequest req) { + return jsonRpcHandler.onGetAuthenticatedExtendedCardRequest(req, context); + } else { + return generateErrorResponse(request, new UnsupportedOperationError()); + } + } + + private Multi> processStreamingRequest( + JSONRPCRequest request, ServerCallContext context) { + Flow.Publisher> publisher; + if (request instanceof SendStreamingMessageRequest req) { + publisher = jsonRpcHandler.onMessageSendStream(req, context); + } else if (request instanceof TaskResubscriptionRequest req) { + publisher = jsonRpcHandler.onResubscribeToTask(req, context); + } else { + return Multi.createFrom().item(generateErrorResponse(request, new UnsupportedOperationError())); + } + return Multi.createFrom().publisher(publisher); + } + + private JSONRPCResponse generateErrorResponse(JSONRPCRequest request, JSONRPCError error) { + return new JSONRPCErrorResponse(request.getId(), error); + } + + static void setStreamingMultiSseSupportSubscribedRunnable(Runnable runnable) { + streamingMultiSseSupportSubscribedRunnable = runnable; + } + + private ServerCallContext createCallContext(RoutingContext rc) { + + if (callContextFactory.isUnsatisfied()) { + User user; + if (rc.user() == null) { + user = UnauthenticatedUser.INSTANCE; + } else { + user = new User() { + @Override + public boolean isAuthenticated() { + return rc.userContext().authenticated(); + } + + @Override + public String getUsername() { + return rc.user().subject(); + } + }; + } + Map state = new HashMap<>(); + // TODO Python's impl has + // state['auth'] = request.auth + // in jsonrpc_app.py. Figure out what this maps to in what Vert.X gives us + + Map headers = new HashMap<>(); + Set headerNames = rc.request().headers().names(); + headerNames.forEach(name -> headers.put(name, rc.request().getHeader(name))); + state.put(HEADERS_KEY, headers); + + // Extract requested extensions from X-A2A-Extensions header + List extensionHeaderValues = rc.request().headers().getAll(A2ACompat03Headers.X_A2A_EXTENSIONS); + Set requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues); + + return new ServerCallContext(user, state, requestedExtensions); + } else { + CallContextFactory builder = callContextFactory.get(); + return builder.build(rc); + } + } + + // Port of import io.quarkus.vertx.web.runtime.MultiSseSupport, which is considered internal API + private static class MultiSseSupport { + + private MultiSseSupport() { + // Avoid direct instantiation. + } + + private static void initialize(HttpServerResponse response) { + if (response.bytesWritten() == 0) { + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + response.setChunked(true); + } + } + + private static void onWriteDone(Flow.Subscription subscription, AsyncResult ar, RoutingContext rc) { + if (ar.failed()) { + rc.fail(ar.cause()); + } else { + subscription.request(1); + } + } + + public static void write(Multi multi, RoutingContext rc) { + HttpServerResponse response = rc.response(); + multi.subscribe().withSubscriber(new Flow.Subscriber() { + Flow.Subscription upstream; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + this.upstream.request(1); + + // Notify tests that we are subscribed + Runnable runnable = streamingMultiSseSupportSubscribedRunnable; + if (runnable != null) { + runnable.run(); + } + } + + @Override + public void onNext(Buffer item) { + initialize(response); + response.write(item, new Handler>() { + @Override + public void handle(AsyncResult ar) { + onWriteDone(upstream, ar, rc); + } + }); + } + + @Override + public void onError(Throwable throwable) { + rc.fail(throwable); + } + + @Override + public void onComplete() { + endOfStream(response); + } + }); + } + + public static void subscribeObject(Multi multi, RoutingContext rc) { + AtomicLong count = new AtomicLong(); + write(multi.map(new Function() { + @Override + public Buffer apply(Object o) { + if (o instanceof ReactiveRoutes.ServerSentEvent) { + ReactiveRoutes.ServerSentEvent ev = (ReactiveRoutes.ServerSentEvent) o; + long id = ev.id() != -1 ? ev.id() : count.getAndIncrement(); + String e = ev.event() == null ? "" : "event: " + ev.event() + "\n"; + return Buffer.buffer(e + "data: " + Utils.toJsonString(ev.data()) + "\nid: " + id + "\n\n"); + } + return Buffer.buffer("data: " + Utils.toJsonString(o) + "\nid: " + count.getAndIncrement() + "\n\n"); + } + }), rc); + } + + private static void endOfStream(HttpServerResponse response) { + if (response.bytesWritten() == 0) { // No item + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + } + response.end(); + } + } +} diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory.java new file mode 100644 index 000000000..6c3af2310 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/CallContextFactory.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.vertx.ext.web.RoutingContext; + +public interface CallContextFactory { + ServerCallContext build(RoutingContext rc); +} diff --git a/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata.java b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata.java new file mode 100644 index 000000000..b1db657ec --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusJSONRPCTransportMetadata.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.a2aproject.sdk.server.TransportMetadata; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +public class QuarkusJSONRPCTransportMetadata implements TransportMetadata { + + @Override + public String getTransportProtocol() { + return TransportProtocol.JSONRPC.asString(); + } +} diff --git a/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutesTest.java b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutesTest.java new file mode 100644 index 000000000..d38209f66 --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2AServerRoutesTest.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2AServerRoutesTest.java + +/** + * Placeholder stub - awaiting server-common port. + */ +@Disabled("Disabled until server-common is ported") +public class A2AServerRoutesTest { + + @Test + public void placeholderTest() { + // This test exists only to make the test class show up as skipped + // Full test implementation commented out - awaiting server-common port + } +} diff --git a/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes.java b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes.java new file mode 100644 index 000000000..53941e5ee --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/A2ATestRoutes.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/A2ATestRoutes.java + +/** + * Placeholder stub - awaiting server-common port. + */ +public class A2ATestRoutes { +} diff --git a/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPCTest.java b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPCTest.java new file mode 100644 index 000000000..3ee1ed82b --- /dev/null +++ b/compat-0.3/reference/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/server/apps/quarkus/QuarkusA2AJSONRPCTest.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.server.apps.quarkus; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/jsonrpc/src/test/java/io/a2a/server/apps/quarkus/QuarkusA2AJSONRPCTest.java + +/** + * Placeholder stub - awaiting server-common port. + */ +@Disabled("Disabled until server-common is ported") +public class QuarkusA2AJSONRPCTest { + + @Test + public void placeholderTest() { + // This test exists only to make the test class show up as skipped + // Full test implementation commented out - awaiting server-common port + } +} diff --git a/compat-0.3/reference/rest/pom.xml b/compat-0.3/reference/rest/pom.xml new file mode 100644 index 000000000..0e03d4db5 --- /dev/null +++ b/compat-0.3/reference/rest/pom.xml @@ -0,0 +1,120 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-reference-rest + + jar + + Java A2A Compat 0.3 Reference Server: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - A2A JSON+HTTP/REST Reference Server (based on Quarkus) + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-transport-rest + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-client-transport-rest + test + + + ${project.groupId} + a2a-java-sdk-tests-server-common + provided + + + ${project.groupId} + a2a-java-sdk-tests-server-common + test-jar + test + + + com.google.protobuf + protobuf-java-util + test + + + io.quarkus + quarkus-reactive-routes + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + org.slf4j + slf4j-api + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-rest-client-jackson + test + + + org.junit.jupiter + junit-jupiter-api + test + + + io.rest-assured + rest-assured + test + + + org.mockito + mockito-core + test + + + org.mockito + mockito-junit-jupiter + test + + + + + + maven-surefire-plugin + 3.5.3 + + + org.jboss.logmanager.LogManager + INFO + ${maven.home} + + + + + + diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes.java new file mode 100644 index 000000000..a93d4aed5 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutes.java @@ -0,0 +1,454 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import static org.a2aproject.sdk.compat03.transport.rest.context.RestContextKeys.HEADERS_KEY; +import static org.a2aproject.sdk.compat03.transport.rest.context.RestContextKeys.METHOD_NAME_KEY; +import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE; +import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; +import static jakarta.ws.rs.core.MediaType.SERVER_SENT_EVENTS; + +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +import jakarta.annotation.security.PermitAll; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; + +import org.a2aproject.sdk.common.A2AHeaders; +import org.a2aproject.sdk.compat03.common.A2ACompat03Headers; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.server.extensions.A2AExtensions; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler.HTTPRestResponse; +import org.a2aproject.sdk.compat03.transport.rest.handler.RestHandler.HTTPRestStreamingResponse; +import io.quarkus.security.Authenticated; +import io.quarkus.vertx.web.Body; +import io.quarkus.vertx.web.ReactiveRoutes; +import io.quarkus.vertx.web.Route; +import io.smallrye.mutiny.Multi; +import io.vertx.core.AsyncResult; +import io.vertx.core.Handler; +import io.vertx.core.MultiMap; +import io.vertx.core.buffer.Buffer; +import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.web.RoutingContext; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.jspecify.annotations.Nullable; + +@Singleton +@Authenticated +public class A2AServerRoutes { + + @Inject + RestHandler jsonRestHandler; + + // Hook so testing can wait until the MultiSseSupport is subscribed. + // Without this we get intermittent failures + private static volatile @Nullable Runnable streamingMultiSseSupportSubscribedRunnable; + + @Inject + @Internal + Executor executor; + + @Inject + Instance callContextFactory; + + @Route(regex = "^/v1/message:send$", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void sendMessage(@Body String body, RoutingContext rc) { + ServerCallContext context = createCallContext(rc, SendMessageRequest.METHOD); + HTTPRestResponse response = null; + try { + response = jsonRestHandler.sendMessage(body, context); + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(regex = "^/v1/message:stream$", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void sendMessageStreaming(@Body String body, RoutingContext rc) { + ServerCallContext context = createCallContext(rc, SendStreamingMessageRequest.METHOD); + HTTPRestStreamingResponse streamingResponse = null; + HTTPRestResponse error = null; + try { + HTTPRestResponse response = jsonRestHandler.sendStreamingMessage(body, context); + if (response instanceof HTTPRestStreamingResponse hTTPRestStreamingResponse) { + streamingResponse = hTTPRestStreamingResponse; + } else { + error = response; + } + } finally { + if (error != null) { + sendResponse(rc, error); + } else if (streamingResponse != null) { + Multi events = Multi.createFrom().publisher(streamingResponse.getPublisher()); + executor.execute(() -> { + MultiSseSupport.subscribeObject( + events.map(i -> (Object) i), rc); + }); + } + } + } + + @Route(path = "/v1/tasks/:id", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void getTask(RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, GetTaskRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + int historyLength = 0; + boolean hasHistoryLength = rc.request().params().contains("history_length"); + boolean hasHistoryLengthCamel = rc.request().params().contains("historyLength"); + + if (hasHistoryLength && hasHistoryLengthCamel) { + response = jsonRestHandler.createErrorResponse( + new InvalidParamsError("Only one of 'history_length' or 'historyLength' may be specified")); + } else if (hasHistoryLength) { + historyLength = Integer.parseInt(rc.request().params().get("history_length")); + } else if (hasHistoryLengthCamel) { + historyLength = Integer.parseInt(rc.request().params().get("historyLength")); + } + + if (response == null) { + response = jsonRestHandler.getTask(taskId, historyLength, context); + } + } + } catch (NumberFormatException e) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad history_length or historyLength")); + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(regex = "^/v1/tasks/([^/]+):cancel$", order = 1, methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void cancelTask(RoutingContext rc) { + String taskId = rc.pathParam("param0"); + ServerCallContext context = createCallContext(rc, CancelTaskRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + response = jsonRestHandler.cancelTask(taskId, context); + } + } catch (Throwable t) { + if (t instanceof JSONRPCError error) { + response = jsonRestHandler.createErrorResponse(error); + } else { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } + } finally { + sendResponse(rc, response); + } + } + + private void sendResponse(RoutingContext rc, @Nullable HTTPRestResponse response) { + if (response != null) { + rc.response() + .setStatusCode(response.getStatusCode()) + .putHeader(CONTENT_TYPE, response.getContentType()) + .end(response.getBody()); + } else { + rc.response().end(); + } + } + + @Route(regex = "^/v1/tasks/([^/]+):subscribe$", order = 1, methods = {Route.HttpMethod.POST}, type = Route.HandlerType.BLOCKING) + public void resubscribeTask(RoutingContext rc) { + String taskId = rc.pathParam("param0"); + ServerCallContext context = createCallContext(rc, TaskResubscriptionRequest.METHOD); + HTTPRestStreamingResponse streamingResponse = null; + HTTPRestResponse error = null; + try { + if (taskId == null || taskId.isEmpty()) { + error = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + HTTPRestResponse response = jsonRestHandler.resubscribeTask(taskId, context); + if (response instanceof HTTPRestStreamingResponse hTTPRestStreamingResponse) { + streamingResponse = hTTPRestStreamingResponse; + } else { + error = response; + } + } + } finally { + if (error != null) { + sendResponse(rc, error); + } else if (streamingResponse != null) { + Multi events = Multi.createFrom().publisher(streamingResponse.getPublisher()); + executor.execute(() -> { + MultiSseSupport.subscribeObject( + events.map(i -> (Object) i), rc); + }); + } + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs", order = 1, methods = {Route.HttpMethod.POST}, consumes = {APPLICATION_JSON}, type = Route.HandlerType.BLOCKING) + public void setTaskPushNotificationConfiguration(@Body String body, RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, SetTaskPushNotificationConfigRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + response = jsonRestHandler.setTaskPushNotificationConfiguration(taskId, body, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs/:configId", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void getTaskPushNotificationConfiguration(RoutingContext rc) { + String taskId = rc.pathParam("id"); + String configId = rc.pathParam("configId"); + ServerCallContext context = createCallContext(rc, GetTaskPushNotificationConfigRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + response = jsonRestHandler.getTaskPushNotificationConfiguration(taskId, configId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs", order = 1, methods = {Route.HttpMethod.GET}, type = Route.HandlerType.BLOCKING) + public void listTaskPushNotificationConfigurations(RoutingContext rc) { + String taskId = rc.pathParam("id"); + ServerCallContext context = createCallContext(rc, ListTaskPushNotificationConfigRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else { + response = jsonRestHandler.listTaskPushNotificationConfigurations(taskId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + @Route(path = "/v1/tasks/:id/pushNotificationConfigs/:configId", order = 1, methods = {Route.HttpMethod.DELETE}, type = Route.HandlerType.BLOCKING) + public void deleteTaskPushNotificationConfiguration(RoutingContext rc) { + String taskId = rc.pathParam("id"); + String configId = rc.pathParam("configId"); + ServerCallContext context = createCallContext(rc, DeleteTaskPushNotificationConfigRequest.METHOD); + HTTPRestResponse response = null; + try { + if (taskId == null || taskId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad task id")); + } else if (configId == null || configId.isEmpty()) { + response = jsonRestHandler.createErrorResponse(new InvalidParamsError("bad config id")); + } else { + response = jsonRestHandler.deleteTaskPushNotificationConfiguration(taskId, configId, context); + } + } catch (Throwable t) { + response = jsonRestHandler.createErrorResponse(new InternalError(t.getMessage())); + } finally { + sendResponse(rc, response); + } + } + + /** + * Handles incoming GET requests to the agent card endpoint. + * Returns the agent card in JSON format. + * + * @param rc the routing context + */ + @Route(path = "/.well-known/agent-card.json", order = 1, methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + @PermitAll + public void getAgentCard(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.getAgentCard(); + sendResponse(rc, response); + } + + @Route(path = "/v1/card", order = 1, methods = Route.HttpMethod.GET, produces = APPLICATION_JSON) + public void getAuthenticatedExtendedCard(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.getAuthenticatedExtendedCard(); + sendResponse(rc, response); + } + + @Route(path = "^/v1/.*", order = 100, methods = {Route.HttpMethod.DELETE, Route.HttpMethod.GET, Route.HttpMethod.HEAD, Route.HttpMethod.OPTIONS, Route.HttpMethod.POST, Route.HttpMethod.PUT}, produces = APPLICATION_JSON) + public void methodNotFoundMessage(RoutingContext rc) { + HTTPRestResponse response = jsonRestHandler.createErrorResponse(new MethodNotFoundError()); + sendResponse(rc, response); + } + + static void setStreamingMultiSseSupportSubscribedRunnable(Runnable runnable) { + streamingMultiSseSupportSubscribedRunnable = runnable; + } + + private ServerCallContext createCallContext(RoutingContext rc, String jsonRpcMethodName) { + if (callContextFactory.isUnsatisfied()) { + User user; + if (rc.user() == null) { + user = UnauthenticatedUser.INSTANCE; + } else { + user = new User() { + @Override + public boolean isAuthenticated() { + if (rc.userContext() != null) { + return rc.userContext().authenticated(); + } + return false; + } + + @Override + public String getUsername() { + if (rc.user() != null) { + String subject = rc.user().subject(); + return subject != null ? subject : ""; + } + return ""; + } + }; + } + Map state = new HashMap<>(); + + Map headers = new HashMap<>(); + Set headerNames = rc.request().headers().names(); + headerNames.forEach(name -> headers.put(name, rc.request().getHeader(name))); + state.put(HEADERS_KEY, headers); + state.put(METHOD_NAME_KEY, jsonRpcMethodName); + + // Extract requested extensions from X-A2A-Extensions header (v0.3 header) + List extensionHeaderValues = rc.request().headers().getAll(A2ACompat03Headers.X_A2A_EXTENSIONS); + Set requestedExtensions = A2AExtensions.getRequestedExtensions(extensionHeaderValues); + + return new ServerCallContext(user, state, requestedExtensions); + } else { + CallContextFactory builder = callContextFactory.get(); + return builder.build(rc); + } + } + + // Port of import io.quarkus.vertx.web.runtime.MultiSseSupport, which is considered internal API + private static class MultiSseSupport { + + private MultiSseSupport() { + // Avoid direct instantiation. + } + + private static void initialize(HttpServerResponse response) { + if (response.bytesWritten() == 0) { + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + response.setChunked(true); + } + } + + private static void onWriteDone(Flow.@Nullable Subscription subscription, AsyncResult ar, RoutingContext rc) { + if (ar.failed()) { + rc.fail(ar.cause()); + } else if (subscription != null) { + subscription.request(1); + } + } + + private static void write(Multi multi, RoutingContext rc) { + HttpServerResponse response = rc.response(); + multi.subscribe().withSubscriber(new Flow.Subscriber() { + Flow.@Nullable Subscription upstream; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + this.upstream.request(1); + + // Notify tests that we are subscribed + Runnable runnable = streamingMultiSseSupportSubscribedRunnable; + if (runnable != null) { + runnable.run(); + } + } + + @Override + public void onNext(Buffer item) { + initialize(response); + response.write(item, new Handler>() { + @Override + public void handle(AsyncResult ar) { + onWriteDone(upstream, ar, rc); + } + }); + } + + @Override + public void onError(Throwable throwable) { + rc.fail(throwable); + } + + @Override + public void onComplete() { + endOfStream(response); + } + }); + } + + private static void subscribeObject(Multi multi, RoutingContext rc) { + AtomicLong count = new AtomicLong(); + write(multi.map(new Function() { + @Override + public Buffer apply(Object o) { + if (o instanceof ReactiveRoutes.ServerSentEvent) { + ReactiveRoutes.ServerSentEvent ev = (ReactiveRoutes.ServerSentEvent) o; + long id = ev.id() != -1 ? ev.id() : count.getAndIncrement(); + String e = ev.event() == null ? "" : "event: " + ev.event() + "\n"; + return Buffer.buffer(e + "data: " + ev.data() + "\nid: " + id + "\n\n"); + } else { + return Buffer.buffer("data: " + o + "\nid: " + count.getAndIncrement() + "\n\n"); + } + } + }), rc); + } + + private static void endOfStream(HttpServerResponse response) { + if (response.bytesWritten() == 0) { // No item + MultiMap headers = response.headers(); + if (headers.get(CONTENT_TYPE) == null) { + headers.set(CONTENT_TYPE, SERVER_SENT_EVENTS); + } + } + response.end(); + } + } +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory.java new file mode 100644 index 000000000..ebb8637d0 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/CallContextFactory.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.vertx.ext.web.RoutingContext; + +public interface CallContextFactory { + ServerCallContext build(RoutingContext rc); +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata.java new file mode 100644 index 000000000..33557547c --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusRestTransportMetadata.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/rest/src/main/java/io/a2a/server/rest/quarkus/QuarkusRestTransportMetadata.java + +/** + * Placeholder stub - awaiting server-common port. + */ +public class QuarkusRestTransportMetadata { +} diff --git a/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java new file mode 100644 index 000000000..c662c2471 --- /dev/null +++ b/compat-0.3/reference/rest/src/main/java/org/a2aproject/sdk/compat03/server/rest/quarkus/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.jspecify.annotations.NullMarked; diff --git a/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutesTest.java b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutesTest.java new file mode 100644 index 000000000..ee786d19e --- /dev/null +++ b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2AServerRoutesTest.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2AServerRoutesTest.java + +/** + * Placeholder stub - awaiting server-common port. + */ +@Disabled("Disabled until server-common is ported") +public class A2AServerRoutesTest { + + @Test + public void placeholderTest() { + // This test exists only to make the test class show up as skipped + // Full test implementation commented out - awaiting server-common port + } +} diff --git a/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes.java b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes.java new file mode 100644 index 000000000..c9494d93c --- /dev/null +++ b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/A2ATestRoutes.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/rest/src/test/java/io/a2a/server/rest/quarkus/A2ATestRoutes.java + +/** + * Placeholder stub - awaiting server-common port. + */ +public class A2ATestRoutes { +} diff --git a/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARestTest.java b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARestTest.java new file mode 100644 index 000000000..baec5bd3d --- /dev/null +++ b/compat-0.3/reference/rest/src/test/java/org/a2aproject/sdk/compat03/server/rest/quarkus/QuarkusA2ARestTest.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.server.rest.quarkus; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +// TODO: Uncomment when server-common is ported +// See: /Users/kabir/sourcecontrol/AI/a2a-java-0.3.x/reference/rest/src/test/java/io/a2a/server/rest/quarkus/QuarkusA2ARestTest.java + +/** + * Placeholder stub - awaiting server-common port. + */ +@Disabled("Disabled until server-common is ported") +public class QuarkusA2ARestTest { + + @Test + public void placeholderTest() { + // This test exists only to make the test class show up as skipped + // Full test implementation commented out - awaiting server-common port + } +} diff --git a/compat-0.3/server-conversion/pom.xml b/compat-0.3/server-conversion/pom.xml new file mode 100644 index 000000000..a5f62c84a --- /dev/null +++ b/compat-0.3/server-conversion/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-server-conversion + + jar + + Java SDK A2A Compat 0.3 Server Conversion + Java SDK for the Agent2Agent Protocol (A2A) - 0.3 to 1.0 Type Conversion Layer + + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + + + ${project.groupId} + a2a-java-sdk-spec + + + + + ${project.groupId} + a2a-java-sdk-server-common + + + + + org.mapstruct + mapstruct + + + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + + ${project.groupId} + a2a-java-sdk-http-client + test + + + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + + + ${project.groupId} + a2a-java-sdk-jsonrpc-common + test + + + + + io.quarkus + quarkus-arc + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert03To10RequestHandler.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert03To10RequestHandler.java new file mode 100644 index 000000000..c0b72346c --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/Convert03To10RequestHandler.java @@ -0,0 +1,332 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.util.List; +import java.util.concurrent.Flow; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import org.a2aproject.sdk.compat03.conversion.mappers.domain.EventKindMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.StreamingEventKindMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.params.CancelTaskParamsMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.params.MessageSendParamsMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.params.TaskIdParamsMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.params.TaskQueryParamsMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.result.ListTaskPushNotificationConfigsResultMapper; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.requesthandlers.RequestHandler; +import org.a2aproject.sdk.spec.A2AError; + +/** + * Request handler that converts v0.3 protocol requests to v1.0 and delegates to the v1.0 {@link RequestHandler}. + *

+ * This class acts as an adapter layer between the v0.3 transport handlers and the v1.0 core request handler. + * It accepts v0.3 spec types, converts them to v1.0 types, delegates to the v1.0 DefaultRequestHandler, + * and converts the results back to v0.3 types. + *

+ * Key responsibilities: + *

    + *
  • Convert v0.3 params to v1.0 params using mappers
  • + *
  • Delegate to v1.0 RequestHandler
  • + *
  • Convert v1.0 results back to v0.3 results
  • + *
  • Handle streaming publishers with element-by-element conversion
  • + *
+ *

+ * Method naming differences between v0.3 and v1.0: + *

    + *
  • {@code onSetTaskPushNotificationConfig} (v0.3) → {@code onCreateTaskPushNotificationConfig} (v1.0)
  • + *
  • {@code onResubscribeToTask} (v0.3) → {@code onSubscribeToTask} (v1.0)
  • + *
  • {@code onListTaskPushNotificationConfig} (v0.3) → {@code onListTaskPushNotificationConfigs} (v1.0)
  • + *
+ */ +@ApplicationScoped +public class Convert03To10RequestHandler { + + /** + * The v1.0 {@link RequestHandler} to which all converted requests are delegated. + */ + @Inject + public RequestHandler v10Handler; + + /** + * Gets a task by ID. + *

+ * v0.3 → v1.0: Converts TaskQueryParams and Task + * + * @param v03Params the v0.3 task query params + * @param context the server call context + * @return the v0.3 task + * @throws A2AError if an error occurs + */ + public org.a2aproject.sdk.compat03.spec.Task onGetTask( + org.a2aproject.sdk.compat03.spec.TaskQueryParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + org.a2aproject.sdk.spec.TaskQueryParams v10Params = TaskQueryParamsMapper.INSTANCE.toV10(v03Params); + + // Call v1.0 handler + org.a2aproject.sdk.spec.Task v10Result = v10Handler.onGetTask(v10Params, context); + + // Convert v1.0 result → v0.3 result + return TaskMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Cancels a task. + *

+ * v0.3 → v1.0: Converts TaskIdParams to CancelTaskParams and Task + * + * @param v03Params the v0.3 task ID params + * @param context the server call context + * @return the v0.3 task + * @throws A2AError if an error occurs + */ + public org.a2aproject.sdk.compat03.spec.Task onCancelTask( + org.a2aproject.sdk.compat03.spec.TaskIdParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 TaskIdParams → v1.0 CancelTaskParams + org.a2aproject.sdk.spec.CancelTaskParams v10Params = CancelTaskParamsMapper.INSTANCE.toV10(v03Params); + + // Call v1.0 handler + org.a2aproject.sdk.spec.Task v10Result = v10Handler.onCancelTask(v10Params, context); + + // Convert v1.0 result → v0.3 result + return TaskMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Sends a message (blocking). + *

+ * v0.3 → v1.0: Converts MessageSendParams and EventKind + * + * @param v03Params the v0.3 message send params + * @param context the server call context + * @return the v0.3 event kind (Task or Message) + * @throws A2AError if an error occurs + */ + public org.a2aproject.sdk.compat03.spec.EventKind onMessageSend( + org.a2aproject.sdk.compat03.spec.MessageSendParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + org.a2aproject.sdk.spec.MessageSendParams v10Params = MessageSendParamsMapper.INSTANCE.toV10(v03Params); + + // Call v1.0 handler + org.a2aproject.sdk.spec.EventKind v10Result = v10Handler.onMessageSend(v10Params, context); + + // Convert v1.0 result → v0.3 result + return EventKindMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Sends a message (streaming). + *

+ * v0.3 → v1.0: Converts MessageSendParams and streams StreamingEventKind + * + * @param v03Params the v0.3 message send params + * @param context the server call context + * @return publisher of v0.3 streaming event kinds + * @throws A2AError if an error occurs + */ + public Flow.Publisher onMessageSendStream( + org.a2aproject.sdk.compat03.spec.MessageSendParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + org.a2aproject.sdk.spec.MessageSendParams v10Params = MessageSendParamsMapper.INSTANCE.toV10(v03Params); + + // Get v1.0 publisher + Flow.Publisher v10Publisher = + v10Handler.onMessageSendStream(v10Params, context); + + // Convert each event using a mapping processor + return convertPublisher(v10Publisher, StreamingEventKindMapper.INSTANCE::fromV10); + } + + /** + * Sets (creates) a task push notification configuration. + *

+ * v0.3 method name: {@code onSetTaskPushNotificationConfig} + * v1.0 method name: {@code onCreateTaskPushNotificationConfig} + * + * @param v03Config the v0.3 task push notification config + * @param context the server call context + * @return the v0.3 task push notification config + * @throws A2AError if an error occurs + */ + public org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig onSetTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig v03Config, + ServerCallContext context) throws A2AError { + + // Convert v0.3 config → v1.0 config + org.a2aproject.sdk.spec.TaskPushNotificationConfig v10Config = + TaskPushNotificationConfigMapper.INSTANCE.toV10(v03Config); + + // Call v1.0 handler + org.a2aproject.sdk.spec.TaskPushNotificationConfig v10Result = + v10Handler.onCreateTaskPushNotificationConfig(v10Config, context); + + // Convert v1.0 result → v0.3 result + return TaskPushNotificationConfigMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Gets a task push notification configuration. + *

+ * v0.3 → v1.0: Converts GetTaskPushNotificationConfigParams and TaskPushNotificationConfig + * + * @param v03Params the v0.3 get params + * @param context the server call context + * @return the v0.3 task push notification config + * @throws A2AError if an error occurs + */ + public org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig onGetTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + // v0.3: id = taskId, pushNotificationConfigId = optional config id + // v1.0: taskId = taskId, id = config id (defaults to taskId if not specified) + String configId = v03Params.pushNotificationConfigId() != null + ? v03Params.pushNotificationConfigId() + : v03Params.id(); // Default to taskId when config id not specified + + org.a2aproject.sdk.spec.GetTaskPushNotificationConfigParams v10Params = + new org.a2aproject.sdk.spec.GetTaskPushNotificationConfigParams(v03Params.id(), configId); + + // Call v1.0 handler + org.a2aproject.sdk.spec.TaskPushNotificationConfig v10Result = + v10Handler.onGetTaskPushNotificationConfig(v10Params, context); + + // Convert v1.0 result → v0.3 result + return TaskPushNotificationConfigMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Resubscribes to task updates (streaming). + *

+ * v0.3 method name: {@code onResubscribeToTask} + * v1.0 method name: {@code onSubscribeToTask} + * + * @param v03Params the v0.3 task ID params + * @param context the server call context + * @return publisher of v0.3 streaming event kinds + * @throws A2AError if an error occurs + */ + public Flow.Publisher onResubscribeToTask( + org.a2aproject.sdk.compat03.spec.TaskIdParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + org.a2aproject.sdk.spec.TaskIdParams v10Params = TaskIdParamsMapper.INSTANCE.toV10(v03Params); + + // Get v1.0 publisher + Flow.Publisher v10Publisher = + v10Handler.onSubscribeToTask(v10Params, context); + + // Convert each event using a mapping processor + return convertPublisher(v10Publisher, StreamingEventKindMapper.INSTANCE::fromV10); + } + + /** + * Lists task push notification configurations. + *

+ * v0.3 → v1.0: Converts params and result (List → ListTaskPushNotificationConfigsResult) + * + * @param v03Params the v0.3 list params + * @param context the server call context + * @return list of v0.3 task push notification configs + * @throws A2AError if an error occurs + */ + public List onListTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params + // ListTaskPushNotificationConfigParams has different structure - v0.3 has id, v1.0 has more fields + org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsParams v10Params = + new org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsParams( + v03Params.id(), + 0, // No pageSize in v0.3 - use 0 (will use default) + "", // No pageToken in v0.3 - use empty string + "" // Default tenant + ); + + // Call v1.0 handler + org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsResult v10Result = + v10Handler.onListTaskPushNotificationConfigs(v10Params, context); + + // Convert v1.0 result → v0.3 result (extract list from result wrapper) + return ListTaskPushNotificationConfigsResultMapper.INSTANCE.fromV10(v10Result); + } + + /** + * Deletes a task push notification configuration. + *

+ * v0.3 → v1.0: Converts DeleteTaskPushNotificationConfigParams (adds tenant field) + * + * @param v03Params the v0.3 delete params + * @param context the server call context + * @throws A2AError if an error occurs + */ + public void onDeleteTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams v03Params, + ServerCallContext context) throws A2AError { + + // Convert v0.3 params → v1.0 params (add tenant field) + org.a2aproject.sdk.spec.DeleteTaskPushNotificationConfigParams v10Params = + new org.a2aproject.sdk.spec.DeleteTaskPushNotificationConfigParams( + v03Params.id(), + v03Params.pushNotificationConfigId(), + "" // Default tenant + ); + + // Call v1.0 handler + v10Handler.onDeleteTaskPushNotificationConfig(v10Params, context); + } + + /** + * Converts a v1.0 publisher to a v0.3 publisher by applying a mapper to each element. + * + * @param v10Publisher the v1.0 publisher + * @param mapper function to convert each v1.0 element to v0.3 + * @param the v1.0 element type + * @param the v0.3 element type + * @return publisher of v0.3 elements + */ + private Flow.Publisher convertPublisher( + Flow.Publisher v10Publisher, + java.util.function.Function mapper) { + + return subscriber -> v10Publisher.subscribe(new Flow.Subscriber() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriber.onSubscribe(subscription); + } + + @Override + public void onNext(V10 v10Item) { + try { + V03 v03Item = mapper.apply(v10Item); + subscriber.onNext(v03Item); + } catch (Exception e) { + subscriber.onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + subscriber.onError(throwable); + } + + @Override + public void onComplete() { + subscriber.onComplete(); + } + }); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter.java new file mode 100644 index 000000000..a998edf6b --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/ErrorConverter.java @@ -0,0 +1,79 @@ +package org.a2aproject.sdk.compat03.conversion; + +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import org.a2aproject.sdk.spec.A2AError; + +/** + * Utility for converting v1.0 A2AError instances to v0.3 JSONRPCError instances. + *

+ * This converter preserves specific error types to ensure proper status code mapping + * in transport handlers (REST HTTP status codes, gRPC status codes, etc.). + *

+ */ +public final class ErrorConverter { + + private ErrorConverter() { + // Utility class + } + + /** + * Converts a v1.0 A2AError to a v0.3 JSONRPCError. + *

+ * Since A2AError in v0.3 is an interface and JSONRPCError is the concrete implementation, + * we need to convert the v1.0 A2AError to the v0.3 JSONRPCError type. + * This method preserves specific error types by using instanceof checks to map + * v1.0 errors to their v0.3 equivalents. + *

+ * + * @param v10Error the v1.0 A2AError to convert + * @return the equivalent v0.3 JSONRPCError, preserving the specific error type + */ + public static JSONRPCError convertA2AError(A2AError v10Error) { + // A2AError from v1.0 has: code, message (via getMessage()), details + // JSONRPCError from v0.3 has: code, message (via getMessage()), data + // Preserve exact error code, message, and details from v1.0 error + + // Preserve specific error types by mapping v1.0 errors to v0.3 equivalents + if (v10Error instanceof org.a2aproject.sdk.spec.TaskNotFoundError) { + return new TaskNotFoundError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.UnsupportedOperationError) { + return new UnsupportedOperationError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.TaskNotCancelableError) { + return new TaskNotCancelableError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.InvalidParamsError) { + return new InvalidParamsError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.InvalidRequestError) { + return new InvalidRequestError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.InternalError) { + return new InternalError(v10Error.getMessage()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.InvalidAgentResponseError) { + return new InvalidAgentResponseError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.ContentTypeNotSupportedError) { + return new ContentTypeNotSupportedError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.PushNotificationNotSupportedError) { + return new PushNotificationNotSupportedError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.MethodNotFoundError) { + return new MethodNotFoundError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.JSONParseError) { + return new JSONParseError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } else if (v10Error instanceof org.a2aproject.sdk.spec.ExtendedAgentCardNotConfiguredError) { + return new AuthenticatedExtendedCardNotConfiguredError( + v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } + + // Fallback to generic JSONRPCError for unmapped types + return new JSONRPCError(v10Error.getCode(), v10Error.getMessage(), v10Error.getDetails()); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03Mappers.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03Mappers.java new file mode 100644 index 000000000..d5951f468 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03Mappers.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.config; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Singleton factory for MapStruct mapper instances in the v0.3 to v1.0 conversion layer. + *

+ * This factory provides centralized access to mapper implementations, ensuring that + * each mapper interface has exactly one instance (singleton pattern). MapStruct + * generates implementation classes with an "Impl" suffix at compile time, and this + * factory uses reflection to instantiate and cache them. + *

+ * Example usage: + *

{@code
+ * public interface TaskStateMapper {
+ *     TaskStateMapper INSTANCE = A03Mappers.getMapper(TaskStateMapper.class);
+ *
+ *     org.a2aproject.sdk.spec.TaskState toV10(
+ *         org.a2aproject.sdk.compat03.spec.TaskState v03);
+ * }
+ * }
+ * + * Thread Safety: This factory uses {@link ConcurrentHashMap} to ensure thread-safe + * lazy initialization of mapper instances. + * + * @see A03ToV10MapperConfig + */ +public final class A03Mappers { + + /** + * Cache of instantiated mapper instances. + * Key: Mapper interface class, Value: Singleton mapper instance + */ + private static final Map, Object> MAPPERS = new ConcurrentHashMap<>(); + + /** + * Private constructor to prevent instantiation. + */ + private A03Mappers() { + throw new UnsupportedOperationException("Utility class cannot be instantiated"); + } + + /** + * Returns the singleton instance of the specified mapper interface. + *

+ * This method uses reflection to load the MapStruct-generated implementation class + * (interface name + "Impl" suffix) and caches it for future use. If the implementation + * class cannot be loaded or instantiated, a {@link RuntimeException} is thrown. + * + * @param mapperInterface the mapper interface class (e.g., {@code TaskStateMapper.class}) + * @param the mapper type + * @return the singleton instance of the mapper + * @throws RuntimeException if the mapper implementation cannot be loaded or instantiated + */ + @SuppressWarnings("unchecked") + public static T getMapper(Class mapperInterface) { + return (T) MAPPERS.computeIfAbsent(mapperInterface, clazz -> { + try { + // MapStruct generates implementation with "Impl" suffix + String implName = clazz.getName() + "Impl"; + Class implClass = Class.forName(implName); + return implClass.getDeclaredConstructor().newInstance(); + } catch (Exception e) { + throw new RuntimeException("Failed to load mapper: " + clazz.getName(), e); + } + }); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java new file mode 100644 index 000000000..51da7b009 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/config/A03ToV10MapperConfig.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.config; + +import org.mapstruct.MapperConfig; +import org.mapstruct.NullValuePropertyMappingStrategy; +import org.mapstruct.ReportingPolicy; + +/** + * Global MapStruct configuration for converting between A2A Protocol v0.3 and v1.0 types. + *

+ * This configuration interface provides shared settings and default conversion methods + * used by all mappers in the compat-0.3 conversion layer. It ensures consistent handling + * of unmapped fields, null values, and component instantiation across the codebase. + *

+ * Key Configuration: + *

    + *
  • unmappedTargetPolicy = ERROR: Compile-time validation ensures no fields are missed
  • + *
  • componentModel = "default": Uses singleton pattern via {@link A03Mappers} factory
  • + *
  • nullValuePropertyMappingStrategy = IGNORE: Skip null source properties during mapping
  • + *
+ * + * @see A03Mappers + */ +@MapperConfig( + unmappedTargetPolicy = ReportingPolicy.ERROR, + componentModel = "default", + nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE +) +public interface A03ToV10MapperConfig { + + /** + * Default tenant value for conversions from 0.3 to 1.0. + *

+ * The 1.0 protocol adds a tenant field that doesn't exist in 0.3. + * When converting from 0.3 to 1.0, we use an empty string as the default tenant, + * matching the 1.0 MessageSendParams convenience constructor default. + * + * @return empty string as default tenant + */ + default String tenantDefault() { + return ""; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper.java new file mode 100644 index 000000000..f1e286ea0 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/ArtifactMapper.java @@ -0,0 +1,81 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.Artifact; +import org.a2aproject.sdk.spec.Part; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Artifact between A2A Protocol v0.3 and v1.0. + *

+ * Both versions are records with the same structure: + * {@code Artifact(artifactId, name, description, parts, metadata, extensions)}. + *

+ * The conversion primarily involves converting the nested {@link Part} list using {@link PartMapper}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {PartMapper.class}) +public interface ArtifactMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + ArtifactMapper INSTANCE = A03Mappers.getMapper(ArtifactMapper.class); + + /** + * Converts v0.3 Artifact to v1.0 Artifact. + *

+ * Converts all Part instances in the parts list using PartMapper. + * + * @param v03 the v0.3 artifact + * @return the equivalent v1.0 artifact + */ + default Artifact toV10(org.a2aproject.sdk.compat03.spec.Artifact v03) { + if (v03 == null) { + return null; + } + + List> parts = v03.parts().stream() + .map(PartMapper.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new Artifact( + v03.artifactId(), + v03.name(), + v03.description(), + parts, + v03.metadata(), + v03.extensions() + ); + } + + /** + * Converts v1.0 Artifact to v0.3 Artifact. + *

+ * Converts all Part instances in the parts list using PartMapper. + * + * @param v10 the v1.0 artifact + * @return the equivalent v0.3 artifact + */ + default org.a2aproject.sdk.compat03.spec.Artifact fromV10(Artifact v10) { + if (v10 == null) { + return null; + } + + List> parts = v10.parts().stream() + .map(PartMapper.INSTANCE::fromV10) + .collect(Collectors.toList()); + + return new org.a2aproject.sdk.compat03.spec.Artifact( + v10.artifactId(), + v10.name(), + v10.description(), + parts, + v10.metadata(), + v10.extensions() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper.java new file mode 100644 index 000000000..949c6500f --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/AuthenticationInfoMapper.java @@ -0,0 +1,117 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.AuthenticationInfo; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting AuthenticationInfo between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code AuthenticationInfo(List schemes, String credentials)} - supports multiple schemes
  • + *
  • v1.0: {@code AuthenticationInfo(String scheme, String credentials)} - single scheme only
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Takes the first scheme from the list (or empty string if list is empty)
  • + *
  • v1.0 → v0.3: Wraps the single scheme in a list
  • + *
+ *

+ * Note: v0.3 also has {@code PushNotificationAuthenticationInfo} which has the same structure + * as v0.3 {@code AuthenticationInfo}, so this mapper handles both. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface AuthenticationInfoMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + AuthenticationInfoMapper INSTANCE = A03Mappers.getMapper(AuthenticationInfoMapper.class); + + /** + * Converts v0.3 AuthenticationInfo to v1.0 AuthenticationInfo. + *

+ * Takes the first scheme from the v0.3 schemes list. If the list is empty or null, + * uses an empty string for the v1.0 scheme. + * + * @param v03 the v0.3 authentication info + * @return the equivalent v1.0 authentication info + */ + default AuthenticationInfo toV10(org.a2aproject.sdk.compat03.spec.AuthenticationInfo v03) { + if (v03 == null) { + return null; + } + + String scheme = (v03.schemes() != null && !v03.schemes().isEmpty()) + ? v03.schemes().get(0) + : ""; + + return new AuthenticationInfo(scheme, v03.credentials()); + } + + /** + * Converts v0.3 PushNotificationAuthenticationInfo to v1.0 AuthenticationInfo. + *

+ * Takes the first scheme from the v0.3 schemes list. If the list is empty or null, + * uses an empty string for the v1.0 scheme. + * + * @param v03 the v0.3 push notification authentication info + * @return the equivalent v1.0 authentication info + */ + default AuthenticationInfo toV10FromPushNotification( + org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo v03) { + if (v03 == null) { + return null; + } + + String scheme = (v03.schemes() != null && !v03.schemes().isEmpty()) + ? v03.schemes().get(0) + : ""; + + return new AuthenticationInfo(scheme, v03.credentials()); + } + + /** + * Converts v1.0 AuthenticationInfo to v0.3 AuthenticationInfo. + *

+ * Wraps the v1.0 single scheme in a list for v0.3. + * + * @param v10 the v1.0 authentication info + * @return the equivalent v0.3 authentication info + */ + default org.a2aproject.sdk.compat03.spec.AuthenticationInfo fromV10(AuthenticationInfo v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.AuthenticationInfo( + List.of(v10.scheme()), + v10.credentials() + ); + } + + /** + * Converts v1.0 AuthenticationInfo to v0.3 PushNotificationAuthenticationInfo. + *

+ * Wraps the v1.0 single scheme in a list for v0.3. + * + * @param v10 the v1.0 authentication info + * @return the equivalent v0.3 push notification authentication info + */ + default org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo fromV10ToPushNotification( + AuthenticationInfo v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo( + List.of(v10.scheme()), + v10.credentials() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper.java new file mode 100644 index 000000000..1986cfa19 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/EventKindMapper.java @@ -0,0 +1,92 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.EventKind; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional polymorphic mapper for converting EventKind between A2A Protocol v0.3 and v1.0. + *

+ * Handles conversion for all EventKind implementers: + *

    + *
  • {@link Task}
  • + *
  • {@link Message}
  • + *
  • {@link TaskStatusUpdateEvent}
  • + *
  • {@link TaskArtifactUpdateEvent}
  • + *
+ *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = { + TaskMapper.class, + MessageMapper.class, + TaskStatusUpdateEventMapper.class, + TaskArtifactUpdateEventMapper.class +}) +public interface EventKindMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + EventKindMapper INSTANCE = A03Mappers.getMapper(EventKindMapper.class); + + /** + * Converts v0.3 EventKind to v1.0 EventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v03 the v0.3 event kind + * @return the equivalent v1.0 event kind + * @throws InvalidRequestError if the event kind type is unrecognized + */ + default EventKind toV10(org.a2aproject.sdk.compat03.spec.EventKind v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof org.a2aproject.sdk.compat03.spec.Task v03Task) { + return TaskMapper.INSTANCE.toV10(v03Task); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.Message v03Message) { + return MessageMapper.INSTANCE.toV10(v03Message); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent v03StatusUpdate) { + return TaskStatusUpdateEventMapper.INSTANCE.toV10(v03StatusUpdate); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent v03ArtifactUpdate) { + return TaskArtifactUpdateEventMapper.INSTANCE.toV10(v03ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized EventKind type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 EventKind to v0.3 EventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v10 the v1.0 event kind + * @return the equivalent v0.3 event kind + * @throws InvalidRequestError if the event kind type is unrecognized + */ + default org.a2aproject.sdk.compat03.spec.EventKind fromV10(EventKind v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof Task v10Task) { + return TaskMapper.INSTANCE.fromV10(v10Task); + } else if (v10 instanceof Message v10Message) { + return MessageMapper.INSTANCE.fromV10(v10Message); + } else if (v10 instanceof TaskStatusUpdateEvent v10StatusUpdate) { + return TaskStatusUpdateEventMapper.INSTANCE.fromV10(v10StatusUpdate); + } else if (v10 instanceof TaskArtifactUpdateEvent v10ArtifactUpdate) { + return TaskArtifactUpdateEventMapper.INSTANCE.fromV10(v10ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized EventKind type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper.java new file mode 100644 index 000000000..ce8e554e7 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/FileContentMapper.java @@ -0,0 +1,89 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.FileContent; +import org.a2aproject.sdk.spec.FileWithBytes; +import org.a2aproject.sdk.spec.FileWithUri; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting FileContent types between A2A Protocol v0.3 and v1.0. + *

+ * Handles polymorphic FileContent conversion for: + *

    + *
  • {@link org.a2aproject.sdk.compat03.spec.FileWithBytes} ↔ {@link FileWithBytes}
  • + *
  • {@link org.a2aproject.sdk.compat03.spec.FileWithUri} ↔ {@link FileWithUri}
  • + *
+ *

+ * Key differences: + *

    + *
  • v0.3: FileWithBytes and FileWithUri are simple records
  • + *
  • v1.0: FileWithBytes is a complex class with lazy loading; FileWithUri is a simple record
  • + *
+ *

+ * The conversion preserves the mimeType, name, and content (bytes or uri) fields across both versions. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface FileContentMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + FileContentMapper INSTANCE = A03Mappers.getMapper(FileContentMapper.class); + + /** + * Converts v0.3 FileContent to v1.0 FileContent. + *

+ * Handles FileWithBytes and FileWithUri polymorphism using instanceof dispatch. + * + * @param v03 the v0.3 file content + * @return the equivalent v1.0 file content + * @throws InvalidRequestError if the file content type is unrecognized + */ + default FileContent toV10(org.a2aproject.sdk.compat03.spec.FileContent v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof org.a2aproject.sdk.compat03.spec.FileWithBytes v03Bytes) { + return new FileWithBytes(v03Bytes.mimeType(), v03Bytes.name(), v03Bytes.bytes()); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.FileWithUri v03Uri) { + return new FileWithUri(v03Uri.mimeType(), v03Uri.name(), v03Uri.uri()); + } + + throw new InvalidRequestError(null, "Unrecognized FileContent type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 FileContent to v0.3 FileContent. + *

+ * Handles FileWithBytes and FileWithUri polymorphism using instanceof dispatch. + * + * @param v10 the v1.0 file content + * @return the equivalent v0.3 file content + * @throws InvalidRequestError if the file content type is unrecognized + */ + default org.a2aproject.sdk.compat03.spec.FileContent fromV10(FileContent v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof FileWithBytes v10Bytes) { + return new org.a2aproject.sdk.compat03.spec.FileWithBytes( + v10Bytes.mimeType(), + v10Bytes.name(), + v10Bytes.bytes() + ); + } else if (v10 instanceof FileWithUri v10Uri) { + return new org.a2aproject.sdk.compat03.spec.FileWithUri( + v10Uri.mimeType(), + v10Uri.name(), + v10Uri.uri() + ); + } + + throw new InvalidRequestError(null, "Unrecognized FileContent type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper.java new file mode 100644 index 000000000..4ae637b7e --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/MessageMapper.java @@ -0,0 +1,95 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Part; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Message between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Message is a class with getter methods (e.g., {@code getRole()}, {@code getParts()})
  • + *
  • v1.0: Message is a record with accessor methods (e.g., {@code role()}, {@code parts()})
  • + *
  • Role enum values have "ROLE_" prefix in v1.0
  • + *
  • Part types (TextPart, FilePart, DataPart) changed from classes to records in v1.0
  • + *
+ *

+ * Uses {@link RoleMapper} and {@link PartMapper} for nested conversions. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {RoleMapper.class, PartMapper.class}) +public interface MessageMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + MessageMapper INSTANCE = A03Mappers.getMapper(MessageMapper.class); + + /** + * Converts v0.3 Message to v1.0 Message. + *

+ * Converts all fields including role, parts, messageId, contextId, taskId, + * referenceTaskIds, metadata, and extensions. + * + * @param v03 the v0.3 message + * @return the equivalent v1.0 message + */ + default Message toV10(org.a2aproject.sdk.compat03.spec.Message v03) { + if (v03 == null) { + return null; + } + + Message.Role role = RoleMapper.INSTANCE.toV10(v03.getRole()); + List> parts = v03.getParts().stream() + .map(PartMapper.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new Message( + role, + parts, + v03.getMessageId(), + v03.getContextId(), + v03.getTaskId(), + v03.getReferenceTaskIds(), + v03.getMetadata(), + v03.getExtensions() + ); + } + + /** + * Converts v1.0 Message to v0.3 Message. + *

+ * Converts all fields including role, parts, messageId, contextId, taskId, + * referenceTaskIds, metadata, and extensions. + * + * @param v10 the v1.0 message + * @return the equivalent v0.3 message + */ + default org.a2aproject.sdk.compat03.spec.Message fromV10(Message v10) { + if (v10 == null) { + return null; + } + + org.a2aproject.sdk.compat03.spec.Message.Role role = RoleMapper.INSTANCE.fromV10(v10.role()); + List> parts = v10.parts().stream() + .map(PartMapper.INSTANCE::fromV10) + .collect(Collectors.toList()); + + return new org.a2aproject.sdk.compat03.spec.Message( + role, + parts, + v10.messageId(), + v10.contextId(), + v10.taskId(), + v10.referenceTaskIds(), + v10.metadata(), + v10.extensions() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper.java new file mode 100644 index 000000000..c465733dd --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/PartMapper.java @@ -0,0 +1,100 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.DataPart; +import org.a2aproject.sdk.spec.FilePart; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Part; +import org.a2aproject.sdk.spec.TextPart; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Part types between A2A Protocol v0.3 and v1.0. + *

+ * Handles polymorphic Part conversion for: + *

    + *
  • {@link org.a2aproject.sdk.compat03.spec.TextPart} ↔ {@link TextPart}
  • + *
  • {@link org.a2aproject.sdk.compat03.spec.FilePart} ↔ {@link FilePart}
  • + *
  • {@link org.a2aproject.sdk.compat03.spec.DataPart} ↔ {@link DataPart}
  • + *
+ *

+ * Key differences: + *

    + *
  • v0.3: Part types are classes with getter methods (e.g., {@code getText()}, {@code getMetadata()})
  • + *
  • v1.0: Part types are records with accessor methods (e.g., {@code text()}, {@code metadata()})
  • + *
+ *

+ * Uses manual instanceof dispatch to handle polymorphic conversion. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface PartMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + PartMapper INSTANCE = A03Mappers.getMapper(PartMapper.class); + + /** + * Converts v0.3 Part to v1.0 Part. + *

+ * Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch. + * + * @param v03 the v0.3 part + * @return the equivalent v1.0 part + * @throws InvalidRequestError if the part type is unrecognized + */ + default Part toV10(org.a2aproject.sdk.compat03.spec.Part v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof org.a2aproject.sdk.compat03.spec.TextPart v03Text) { + return new TextPart(v03Text.getText(), v03Text.getMetadata()); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.FilePart v03File) { + return new FilePart( + FileContentMapper.INSTANCE.toV10(v03File.getFile()), + v03File.getMetadata() + ); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.DataPart v03Data) { + return new DataPart(v03Data.getData(), v03Data.getMetadata()); + } + + throw new InvalidRequestError(null, "Unrecognized Part type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 Part to v0.3 Part. + *

+ * Handles TextPart, FilePart, and DataPart polymorphism using instanceof dispatch. + * + * @param v10 the v1.0 part + * @return the equivalent v0.3 part + * @throws InvalidRequestError if the part type is unrecognized + */ + default org.a2aproject.sdk.compat03.spec.Part fromV10(Part v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof TextPart v10Text) { + return new org.a2aproject.sdk.compat03.spec.TextPart(v10Text.text(), v10Text.metadata()); + } else if (v10 instanceof FilePart v10File) { + return new org.a2aproject.sdk.compat03.spec.FilePart( + FileContentMapper.INSTANCE.fromV10(v10File.file()), + v10File.metadata() + ); + } else if (v10 instanceof DataPart v10Data) { + // v1.0 DataPart.data() returns Object, but v0.3 expects Map + Object data = v10Data.data(); + if (!(data instanceof java.util.Map)) { + throw new InvalidRequestError(null, "DataPart data must be a Map for v0.3 compatibility", null); + } + @SuppressWarnings("unchecked") + java.util.Map dataMap = (java.util.Map) data; + return new org.a2aproject.sdk.compat03.spec.DataPart(dataMap, v10Data.metadata()); + } + + throw new InvalidRequestError(null, "Unrecognized Part type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper.java new file mode 100644 index 000000000..362f66e78 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/RoleMapper.java @@ -0,0 +1,59 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.Message; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Message.Role enum between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code USER}, {@code AGENT}
  • + *
  • v1.0: {@code ROLE_USER}, {@code ROLE_AGENT}
  • + *
+ *

+ * The v1.0 enum adds a "ROLE_" prefix to align with protocol buffer conventions. + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface RoleMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + RoleMapper INSTANCE = A03Mappers.getMapper(RoleMapper.class); + + /** + * Converts v0.3 Role to v1.0 Role. + * + * @param v03 the v0.3 role + * @return the equivalent v1.0 role + */ + default Message.Role toV10(org.a2aproject.sdk.compat03.spec.Message.Role v03) { + if (v03 == null) { + return null; + } + return switch (v03) { + case USER -> Message.Role.ROLE_USER; + case AGENT -> Message.Role.ROLE_AGENT; + }; + } + + /** + * Converts v1.0 Role to v0.3 Role. + * + * @param v10 the v1.0 role + * @return the equivalent v0.3 role + */ + default org.a2aproject.sdk.compat03.spec.Message.Role fromV10(Message.Role v10) { + if (v10 == null) { + return null; + } + return switch (v10) { + case ROLE_USER -> org.a2aproject.sdk.compat03.spec.Message.Role.USER; + case ROLE_AGENT -> org.a2aproject.sdk.compat03.spec.Message.Role.AGENT; + default -> throw new IllegalArgumentException("Unrecognized Role: " + v10); + }; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper.java new file mode 100644 index 000000000..aeccfaef6 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/StreamingEventKindMapper.java @@ -0,0 +1,95 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.InvalidRequestError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.StreamingEventKind; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional polymorphic mapper for converting StreamingEventKind between A2A Protocol v0.3 and v1.0. + *

+ * Handles conversion for all StreamingEventKind implementers: + *

    + *
  • {@link Task}
  • + *
  • {@link Message}
  • + *
  • {@link TaskStatusUpdateEvent}
  • + *
  • {@link TaskArtifactUpdateEvent}
  • + *
+ *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + *

+ * Note: The same types implement both {@link org.a2aproject.sdk.spec.EventKind} and + * {@link StreamingEventKind}, so this mapper uses the same delegation logic as {@link EventKindMapper}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = { + TaskMapper.class, + MessageMapper.class, + TaskStatusUpdateEventMapper.class, + TaskArtifactUpdateEventMapper.class +}) +public interface StreamingEventKindMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + StreamingEventKindMapper INSTANCE = A03Mappers.getMapper(StreamingEventKindMapper.class); + + /** + * Converts v0.3 StreamingEventKind to v1.0 StreamingEventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v03 the v0.3 streaming event kind + * @return the equivalent v1.0 streaming event kind + * @throws InvalidRequestError if the streaming event kind type is unrecognized + */ + default StreamingEventKind toV10(org.a2aproject.sdk.compat03.spec.StreamingEventKind v03) { + if (v03 == null) { + return null; + } + + if (v03 instanceof org.a2aproject.sdk.compat03.spec.Task v03Task) { + return TaskMapper.INSTANCE.toV10(v03Task); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.Message v03Message) { + return MessageMapper.INSTANCE.toV10(v03Message); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent v03StatusUpdate) { + return TaskStatusUpdateEventMapper.INSTANCE.toV10(v03StatusUpdate); + } else if (v03 instanceof org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent v03ArtifactUpdate) { + return TaskArtifactUpdateEventMapper.INSTANCE.toV10(v03ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized StreamingEventKind type: " + v03.getClass().getName(), null); + } + + /** + * Converts v1.0 StreamingEventKind to v0.3 StreamingEventKind. + *

+ * Uses instanceof dispatch to determine the concrete type and delegates to the appropriate mapper. + * + * @param v10 the v1.0 streaming event kind + * @return the equivalent v0.3 streaming event kind + * @throws InvalidRequestError if the streaming event kind type is unrecognized + */ + default org.a2aproject.sdk.compat03.spec.StreamingEventKind fromV10(StreamingEventKind v10) { + if (v10 == null) { + return null; + } + + if (v10 instanceof Task v10Task) { + return TaskMapper.INSTANCE.fromV10(v10Task); + } else if (v10 instanceof Message v10Message) { + return MessageMapper.INSTANCE.fromV10(v10Message); + } else if (v10 instanceof TaskStatusUpdateEvent v10StatusUpdate) { + return TaskStatusUpdateEventMapper.INSTANCE.fromV10(v10StatusUpdate); + } else if (v10 instanceof TaskArtifactUpdateEvent v10ArtifactUpdate) { + return TaskArtifactUpdateEventMapper.INSTANCE.fromV10(v10ArtifactUpdate); + } + + throw new InvalidRequestError(null, "Unrecognized StreamingEventKind type: " + v10.getClass().getName(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper.java new file mode 100644 index 000000000..bcd71a147 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskArtifactUpdateEventMapper.java @@ -0,0 +1,73 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.TaskArtifactUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskArtifactUpdateEvent between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: TaskArtifactUpdateEvent is a class with getter methods (e.g., {@code getTaskId()}, {@code isAppend()})
  • + *
  • v1.0: TaskArtifactUpdateEvent is a record with accessor methods (e.g., {@code taskId()}, {@code append()})
  • + *
+ *

+ * Both versions have the same structure: + * {@code TaskArtifactUpdateEvent(taskId, artifact, contextId, append, lastChunk, metadata)}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {ArtifactMapper.class}) +public interface TaskArtifactUpdateEventMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskArtifactUpdateEventMapper INSTANCE = A03Mappers.getMapper(TaskArtifactUpdateEventMapper.class); + + /** + * Converts v0.3 TaskArtifactUpdateEvent to v1.0 TaskArtifactUpdateEvent. + *

+ * Converts the nested Artifact using ArtifactMapper. + * + * @param v03 the v0.3 task artifact update event + * @return the equivalent v1.0 task artifact update event + */ + default TaskArtifactUpdateEvent toV10(org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent v03) { + if (v03 == null) { + return null; + } + + return new TaskArtifactUpdateEvent( + v03.getTaskId(), + ArtifactMapper.INSTANCE.toV10(v03.getArtifact()), + v03.getContextId(), + v03.isAppend(), + v03.isLastChunk(), + v03.getMetadata() + ); + } + + /** + * Converts v1.0 TaskArtifactUpdateEvent to v0.3 TaskArtifactUpdateEvent. + *

+ * Converts the nested Artifact using ArtifactMapper. + * + * @param v10 the v1.0 task artifact update event + * @return the equivalent v0.3 task artifact update event + */ + default org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent fromV10(TaskArtifactUpdateEvent v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent( + v10.taskId(), + ArtifactMapper.INSTANCE.fromV10(v10.artifact()), + v10.contextId(), + v10.append(), + v10.lastChunk(), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper.java new file mode 100644 index 000000000..c2a17c224 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapper.java @@ -0,0 +1,108 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.Artifact; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting Task between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Task is a class with getter methods (e.g., {@code getId()}, {@code getStatus()})
  • + *
  • v1.0: Task is a record with accessor methods (e.g., {@code id()}, {@code status()})
  • + *
  • v0.3 has a {@code kind} field with {@code getKind()} method
  • + *
  • v1.0 has a {@code kind()} method from the {@link org.a2aproject.sdk.spec.StreamingEventKind} interface
  • + *
+ *

+ * The conversion involves mapping nested types: + *

    + *
  • {@link org.a2aproject.sdk.spec.TaskStatus} via {@link TaskStatusMapper}
  • + *
  • {@link Artifact} list via {@link ArtifactMapper}
  • + *
  • {@link Message} history list via {@link MessageMapper}
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStatusMapper.class, ArtifactMapper.class, MessageMapper.class}) +public interface TaskMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskMapper INSTANCE = A03Mappers.getMapper(TaskMapper.class); + + /** + * Converts v0.3 Task to v1.0 Task. + *

+ * Converts all nested objects including status, artifacts, and history using their respective mappers. + * + * @param v03 the v0.3 task + * @return the equivalent v1.0 task + */ + default Task toV10(org.a2aproject.sdk.compat03.spec.Task v03) { + if (v03 == null) { + return null; + } + + List artifacts = v03.getArtifacts() != null + ? v03.getArtifacts().stream() + .map(ArtifactMapper.INSTANCE::toV10) + .collect(Collectors.toList()) + : null; + + List history = v03.getHistory() != null + ? v03.getHistory().stream() + .map(MessageMapper.INSTANCE::toV10) + .collect(Collectors.toList()) + : null; + + return new Task( + v03.getId(), + v03.getContextId(), + TaskStatusMapper.INSTANCE.toV10(v03.getStatus()), + artifacts, + history, + v03.getMetadata() + ); + } + + /** + * Converts v1.0 Task to v0.3 Task. + *

+ * Converts all nested objects including status, artifacts, and history using their respective mappers. + * + * @param v10 the v1.0 task + * @return the equivalent v0.3 task + */ + default org.a2aproject.sdk.compat03.spec.Task fromV10(Task v10) { + if (v10 == null) { + return null; + } + + List artifacts = v10.artifacts() != null + ? v10.artifacts().stream() + .map(ArtifactMapper.INSTANCE::fromV10) + .collect(Collectors.toList()) + : null; + + List history = v10.history() != null + ? v10.history().stream() + .map(MessageMapper.INSTANCE::fromV10) + .collect(Collectors.toList()) + : null; + + return new org.a2aproject.sdk.compat03.spec.Task( + v10.id(), + v10.contextId(), + TaskStatusMapper.INSTANCE.fromV10(v10.status()), + artifacts, + history, + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper.java new file mode 100644 index 000000000..b0817f6cd --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskPushNotificationConfigMapper.java @@ -0,0 +1,87 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.TaskPushNotificationConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskPushNotificationConfig between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Nested structure with {@code TaskPushNotificationConfig(taskId, PushNotificationConfig)}
  • + *
  • v1.0: Flattened structure with {@code TaskPushNotificationConfig(id, taskId, url, token, authentication, tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Extract fields from nested {@code PushNotificationConfig}, add tenant field (default "")
  • + *
  • v1.0 → v0.3: Nest url/token/authentication/id into {@code PushNotificationConfig}, drop tenant field
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {AuthenticationInfoMapper.class}) +public interface TaskPushNotificationConfigMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskPushNotificationConfigMapper INSTANCE = A03Mappers.getMapper(TaskPushNotificationConfigMapper.class); + + /** + * Converts v0.3 TaskPushNotificationConfig to v1.0 TaskPushNotificationConfig. + *

+ * Flattens the nested {@code PushNotificationConfig} structure and adds the tenant field (default ""). + * + * @param v03 the v0.3 task push notification config + * @return the equivalent v1.0 task push notification config + */ + default TaskPushNotificationConfig toV10( + org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig v03) { + if (v03 == null) { + return null; + } + + org.a2aproject.sdk.compat03.spec.PushNotificationConfig pushConfig = v03.pushNotificationConfig(); + + // v0.3 id can be null; v1.0 requires non-null id but stores use empty string to auto-assign + String id = pushConfig.id() != null ? pushConfig.id() : ""; + + return new TaskPushNotificationConfig( + id, + v03.taskId(), + pushConfig.url(), + pushConfig.token(), + AuthenticationInfoMapper.INSTANCE.toV10FromPushNotification(pushConfig.authentication()), + "" // Default tenant + ); + } + + /** + * Converts v1.0 TaskPushNotificationConfig to v0.3 TaskPushNotificationConfig. + *

+ * Nests the url/token/authentication/id fields into a {@code PushNotificationConfig} and drops the tenant field. + * + * @param v10 the v1.0 task push notification config + * @return the equivalent v0.3 task push notification config + */ + default org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig fromV10( + TaskPushNotificationConfig v10) { + if (v10 == null) { + return null; + } + + org.a2aproject.sdk.compat03.spec.PushNotificationConfig pushConfig = + new org.a2aproject.sdk.compat03.spec.PushNotificationConfig( + v10.url(), + v10.token(), + AuthenticationInfoMapper.INSTANCE.fromV10ToPushNotification(v10.authentication()), + v10.id() + ); + + return new org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig( + v10.taskId(), + pushConfig + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper.java new file mode 100644 index 000000000..fca08ee30 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStateMapper.java @@ -0,0 +1,113 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskState} enum between A2A Protocol v0.3 and v1.0. + *

+ * This is a critical mapper because v1.0 adds the {@code TASK_STATE_} prefix to all enum constants: + *

    + *
  • v0.3: {@code SUBMITTED, WORKING, ...}
  • + *
  • v1.0: {@code TASK_STATE_SUBMITTED, TASK_STATE_WORKING, ...}
  • + *
+ *

+ * Additionally, the {@code UNKNOWN} state in v0.3 maps to {@code UNRECOGNIZED} in v1.0. + *

+ * This mapper uses manual switch statements instead of {@code @ValueMapping} to: + *

    + *
  • Avoid mapstruct-spi-protobuf enum strategy initialization issues
  • + *
  • Handle explicit null mapping (null → UNRECOGNIZED/UNKNOWN)
  • + *
  • Provide clear, compile-time-safe enum conversions
  • + *
+ * + * @see org.a2aproject.sdk.compat03.spec.TaskState + * @see org.a2aproject.sdk.spec.TaskState + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskStateMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskStateMapper INSTANCE = A03Mappers.getMapper(TaskStateMapper.class); + + /** + * Converts a v0.3 {@code TaskState} to v1.0 {@code TaskState}. + *

+ * Mapping: + *

+     * 0.3                    → 1.0
+     * ─────────────────────────────────────────────
+     * SUBMITTED              → TASK_STATE_SUBMITTED
+     * WORKING                → TASK_STATE_WORKING
+     * INPUT_REQUIRED         → TASK_STATE_INPUT_REQUIRED
+     * AUTH_REQUIRED          → TASK_STATE_AUTH_REQUIRED
+     * COMPLETED              → TASK_STATE_COMPLETED
+     * CANCELED               → TASK_STATE_CANCELED
+     * FAILED                 → TASK_STATE_FAILED
+     * REJECTED               → TASK_STATE_REJECTED
+     * UNKNOWN                → UNRECOGNIZED
+     * null                   → UNRECOGNIZED
+     * 
+ * + * @param v03 the v0.3 task state (may be null) + * @return the equivalent v1.0 task state (never null) + */ + default org.a2aproject.sdk.spec.TaskState toV10(org.a2aproject.sdk.compat03.spec.TaskState v03) { + if (v03 == null) { + return org.a2aproject.sdk.spec.TaskState.UNRECOGNIZED; + } + return switch (v03) { + case SUBMITTED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_SUBMITTED; + case WORKING -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_WORKING; + case INPUT_REQUIRED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_INPUT_REQUIRED; + case AUTH_REQUIRED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_AUTH_REQUIRED; + case COMPLETED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_COMPLETED; + case CANCELED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_CANCELED; + case FAILED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_FAILED; + case REJECTED -> org.a2aproject.sdk.spec.TaskState.TASK_STATE_REJECTED; + case UNKNOWN -> org.a2aproject.sdk.spec.TaskState.UNRECOGNIZED; + }; + } + + /** + * Converts a v1.0 {@code TaskState} to v0.3 {@code TaskState}. + *

+ * Reverse mapping: + *

+     * 1.0                          → 0.3
+     * ───────────────────────────────────────────────────
+     * TASK_STATE_SUBMITTED         → SUBMITTED
+     * TASK_STATE_WORKING           → WORKING
+     * TASK_STATE_INPUT_REQUIRED    → INPUT_REQUIRED
+     * TASK_STATE_AUTH_REQUIRED     → AUTH_REQUIRED
+     * TASK_STATE_COMPLETED         → COMPLETED
+     * TASK_STATE_CANCELED          → CANCELED
+     * TASK_STATE_FAILED            → FAILED
+     * TASK_STATE_REJECTED          → REJECTED
+     * UNRECOGNIZED                 → UNKNOWN
+     * null                         → UNKNOWN
+     * 
+ * + * @param v10 the v1.0 task state (may be null) + * @return the equivalent v0.3 task state (never null) + */ + default org.a2aproject.sdk.compat03.spec.TaskState fromV10(org.a2aproject.sdk.spec.TaskState v10) { + if (v10 == null) { + return org.a2aproject.sdk.compat03.spec.TaskState.UNKNOWN; + } + return switch (v10) { + case TASK_STATE_SUBMITTED -> org.a2aproject.sdk.compat03.spec.TaskState.SUBMITTED; + case TASK_STATE_WORKING -> org.a2aproject.sdk.compat03.spec.TaskState.WORKING; + case TASK_STATE_INPUT_REQUIRED -> org.a2aproject.sdk.compat03.spec.TaskState.INPUT_REQUIRED; + case TASK_STATE_AUTH_REQUIRED -> org.a2aproject.sdk.compat03.spec.TaskState.AUTH_REQUIRED; + case TASK_STATE_COMPLETED -> org.a2aproject.sdk.compat03.spec.TaskState.COMPLETED; + case TASK_STATE_CANCELED -> org.a2aproject.sdk.compat03.spec.TaskState.CANCELED; + case TASK_STATE_FAILED -> org.a2aproject.sdk.compat03.spec.TaskState.FAILED; + case TASK_STATE_REJECTED -> org.a2aproject.sdk.compat03.spec.TaskState.REJECTED; + case UNRECOGNIZED -> org.a2aproject.sdk.compat03.spec.TaskState.UNKNOWN; + }; + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper.java new file mode 100644 index 000000000..d01f0f34d --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusMapper.java @@ -0,0 +1,68 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.TaskStatus; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskStatus between A2A Protocol v0.3 and v1.0. + *

+ * Both versions are records with the same structure: + * {@code TaskStatus(TaskState state, Message message, OffsetDateTime timestamp)}. + *

+ * The conversion involves: + *

    + *
  • Converting {@link org.a2aproject.sdk.compat03.spec.TaskState} to {@link org.a2aproject.sdk.spec.TaskState} (enum prefix mapping)
  • + *
  • Converting {@link org.a2aproject.sdk.compat03.spec.Message} to {@link org.a2aproject.sdk.spec.Message} (class ↔ record)
  • + *
  • Preserving the timestamp field (same type in both versions)
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStateMapper.class, MessageMapper.class}) +public interface TaskStatusMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskStatusMapper INSTANCE = A03Mappers.getMapper(TaskStatusMapper.class); + + /** + * Converts v0.3 TaskStatus to v1.0 TaskStatus. + *

+ * Converts the state enum and message object using their respective mappers. + * + * @param v03 the v0.3 task status + * @return the equivalent v1.0 task status + */ + default TaskStatus toV10(org.a2aproject.sdk.compat03.spec.TaskStatus v03) { + if (v03 == null) { + return null; + } + + return new TaskStatus( + TaskStateMapper.INSTANCE.toV10(v03.state()), + MessageMapper.INSTANCE.toV10(v03.message()), + v03.timestamp() + ); + } + + /** + * Converts v1.0 TaskStatus to v0.3 TaskStatus. + *

+ * Converts the state enum and message object using their respective mappers. + * + * @param v10 the v1.0 task status + * @return the equivalent v0.3 task status + */ + default org.a2aproject.sdk.compat03.spec.TaskStatus fromV10(TaskStatus v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.TaskStatus( + TaskStateMapper.INSTANCE.fromV10(v10.state()), + MessageMapper.INSTANCE.fromV10(v10.message()), + v10.timestamp() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper.java new file mode 100644 index 000000000..8653ab291 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskStatusUpdateEventMapper.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.spec.TaskStatusUpdateEvent; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting TaskStatusUpdateEvent between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: TaskStatusUpdateEvent is a class with getter methods
  • + *
  • v1.0: TaskStatusUpdateEvent is a record with accessor methods
  • + *
+ *

+ * Both versions have the same structure: + * {@code TaskStatusUpdateEvent(taskId, status, contextId, isFinal, metadata)}. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskStatusMapper.class}) +public interface TaskStatusUpdateEventMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskStatusUpdateEventMapper INSTANCE = A03Mappers.getMapper(TaskStatusUpdateEventMapper.class); + + /** + * Converts v0.3 TaskStatusUpdateEvent to v1.0 TaskStatusUpdateEvent. + *

+ * Converts the nested TaskStatus using TaskStatusMapper. + * + * @param v03 the v0.3 task status update event + * @return the equivalent v1.0 task status update event + */ + default TaskStatusUpdateEvent toV10(org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent v03) { + if (v03 == null) { + return null; + } + + return new TaskStatusUpdateEvent( + v03.getTaskId(), + TaskStatusMapper.INSTANCE.toV10(v03.getStatus()), + v03.getContextId(), + v03.isFinal(), + v03.getMetadata() + ); + } + + /** + * Converts v1.0 TaskStatusUpdateEvent to v0.3 TaskStatusUpdateEvent. + *

+ * Converts the nested TaskStatus using TaskStatusMapper. + * + * @param v10 the v1.0 task status update event + * @return the equivalent v0.3 task status update event + */ + default org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent fromV10(TaskStatusUpdateEvent v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent( + v10.taskId(), + TaskStatusMapper.INSTANCE.fromV10(v10.status()), + v10.contextId(), + v10.isFinal(), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper.java new file mode 100644 index 000000000..06799bead --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/CancelTaskParamsMapper.java @@ -0,0 +1,70 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import java.util.Collections; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting cancel task parameters between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: Uses {@code TaskIdParams(String id, Map metadata)}
  • + *
  • v1.0: Uses {@code CancelTaskParams(String id, String tenant, Map metadata)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: Convert {@code TaskIdParams} to {@code CancelTaskParams} (add {@code tenant} field = "", preserve {@code metadata})
  • + *
  • 1.0 → 0.3: Convert {@code CancelTaskParams} to {@code TaskIdParams} (drop {@code tenant} field, preserve {@code metadata})
  • + *
+ * + * @see org.a2aproject.sdk.compat03.spec.TaskIdParams + * @see org.a2aproject.sdk.spec.CancelTaskParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface CancelTaskParamsMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + CancelTaskParamsMapper INSTANCE = A03Mappers.getMapper(CancelTaskParamsMapper.class); + + /** + * Converts v0.3 {@code TaskIdParams} to v1.0 {@code CancelTaskParams}. + *

+ * The v0.3 {@code metadata} field is preserved in the v1.0 type, and the v1.0 + * {@code tenant} field is set to the empty string default. + * + * @param v03 the v0.3 task ID params used for cancel operations + * @return the equivalent v1.0 cancel task params + */ + default org.a2aproject.sdk.spec.CancelTaskParams toV10(org.a2aproject.sdk.compat03.spec.TaskIdParams v03) { + if (v03 == null) { + return null; + } + return new org.a2aproject.sdk.spec.CancelTaskParams( + v03.id(), + "", // Default tenant + v03.metadata() != null ? v03.metadata() : Collections.emptyMap() + ); + } + + /** + * Converts v1.0 {@code CancelTaskParams} to v0.3 {@code TaskIdParams}. + *

+ * The v1.0 {@code tenant} field is dropped, and the v1.0 {@code metadata} field + * is preserved in the v0.3 type. + * + * @param v10 the v1.0 cancel task params + * @return the equivalent v0.3 task ID params + */ + default org.a2aproject.sdk.compat03.spec.TaskIdParams fromV10(org.a2aproject.sdk.spec.CancelTaskParams v10) { + if (v10 == null) { + return null; + } + return new org.a2aproject.sdk.compat03.spec.TaskIdParams(v10.id(), v10.metadata()); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper.java new file mode 100644 index 000000000..5a770bd61 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendConfigurationMapper.java @@ -0,0 +1,103 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper; +import org.a2aproject.sdk.spec.MessageSendConfiguration; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting MessageSendConfiguration between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code PushNotificationConfig pushNotificationConfig, Boolean blocking}
  • + *
  • v1.0: {@code TaskPushNotificationConfig taskPushNotificationConfig, Boolean returnImmediately}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • {@code blocking} (v0.3) ↔ {@code returnImmediately} (v1.0): Inverse semantics - {@code returnImmediately = !blocking}
  • + *
  • {@code PushNotificationConfig} wraps to {@code TaskPushNotificationConfig} with empty taskId
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskPushNotificationConfigMapper.class}) +public interface MessageSendConfigurationMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + MessageSendConfigurationMapper INSTANCE = A03Mappers.getMapper(MessageSendConfigurationMapper.class); + + /** + * Converts v0.3 MessageSendConfiguration to v1.0 MessageSendConfiguration. + *

+ * Converts {@code blocking} to {@code returnImmediately} with inverse semantics, + * and wraps {@code PushNotificationConfig} into {@code TaskPushNotificationConfig}. + * + * @param v03 the v0.3 message send configuration + * @return the equivalent v1.0 message send configuration + */ + default MessageSendConfiguration toV10( + org.a2aproject.sdk.compat03.spec.MessageSendConfiguration v03) { + if (v03 == null) { + return null; + } + + // Convert PushNotificationConfig to TaskPushNotificationConfig if present + org.a2aproject.sdk.spec.TaskPushNotificationConfig taskPushConfig = null; + if (v03.pushNotificationConfig() != null) { + // Wrap the push notification config with an empty taskId (will be set by the server) + org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig v03TaskConfig = + new org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig( + "", // Empty taskId - will be populated by server + v03.pushNotificationConfig() + ); + taskPushConfig = TaskPushNotificationConfigMapper.INSTANCE.toV10(v03TaskConfig); + } + + // Convert blocking to returnImmediately (inverse semantics) + Boolean returnImmediately = v03.blocking() != null ? !v03.blocking() : null; + + return new MessageSendConfiguration( + v03.acceptedOutputModes(), + v03.historyLength(), + taskPushConfig, + returnImmediately + ); + } + + /** + * Converts v1.0 MessageSendConfiguration to v0.3 MessageSendConfiguration. + *

+ * Converts {@code returnImmediately} to {@code blocking} with inverse semantics, + * and extracts {@code PushNotificationConfig} from {@code TaskPushNotificationConfig}. + * + * @param v10 the v1.0 message send configuration + * @return the equivalent v0.3 message send configuration + */ + default org.a2aproject.sdk.compat03.spec.MessageSendConfiguration fromV10( + MessageSendConfiguration v10) { + if (v10 == null) { + return null; + } + + // Extract PushNotificationConfig from TaskPushNotificationConfig if present + org.a2aproject.sdk.compat03.spec.PushNotificationConfig pushConfig = null; + if (v10.taskPushNotificationConfig() != null) { + org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig v03TaskConfig = + TaskPushNotificationConfigMapper.INSTANCE.fromV10(v10.taskPushNotificationConfig()); + pushConfig = v03TaskConfig.pushNotificationConfig(); + } + + // Convert returnImmediately to blocking (inverse semantics) + Boolean blocking = v10.returnImmediately() != null ? !v10.returnImmediately() : null; + + return new org.a2aproject.sdk.compat03.spec.MessageSendConfiguration( + v10.acceptedOutputModes(), + v10.historyLength(), + pushConfig, + blocking + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper.java new file mode 100644 index 000000000..77bb455f0 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/MessageSendParamsMapper.java @@ -0,0 +1,74 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.MessageMapper; +import org.a2aproject.sdk.spec.MessageSendParams; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting MessageSendParams between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code MessageSendParams(message, configuration, metadata)} - no tenant field
  • + *
  • v1.0: {@code MessageSendParams(message, configuration, metadata, tenant)} - adds tenant field
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Add tenant field with default value ""
  • + *
  • v1.0 → v0.3: Drop tenant field
  • + *
+ *

+ * Uses {@link MessageMapper} and {@link MessageSendConfigurationMapper} for nested conversions. + */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {MessageMapper.class, MessageSendConfigurationMapper.class}) +public interface MessageSendParamsMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + MessageSendParamsMapper INSTANCE = A03Mappers.getMapper(MessageSendParamsMapper.class); + + /** + * Converts v0.3 MessageSendParams to v1.0 MessageSendParams. + *

+ * Adds the tenant field with default value "". + * + * @param v03 the v0.3 message send params + * @return the equivalent v1.0 message send params + */ + default MessageSendParams toV10(org.a2aproject.sdk.compat03.spec.MessageSendParams v03) { + if (v03 == null) { + return null; + } + + return new MessageSendParams( + MessageMapper.INSTANCE.toV10(v03.message()), + MessageSendConfigurationMapper.INSTANCE.toV10(v03.configuration()), + v03.metadata(), + "" // Default tenant + ); + } + + /** + * Converts v1.0 MessageSendParams to v0.3 MessageSendParams. + *

+ * Drops the tenant field. + * + * @param v10 the v1.0 message send params + * @return the equivalent v0.3 message send params + */ + default org.a2aproject.sdk.compat03.spec.MessageSendParams fromV10(MessageSendParams v10) { + if (v10 == null) { + return null; + } + + return new org.a2aproject.sdk.compat03.spec.MessageSendParams( + MessageMapper.INSTANCE.fromV10(v10.message()), + MessageSendConfigurationMapper.INSTANCE.fromV10(v10.configuration()), + v10.metadata() + ); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper.java new file mode 100644 index 000000000..8526e1c22 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskIdParamsMapper.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskIdParams} between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code TaskIdParams(String id, Map metadata)}
  • + *
  • v1.0: {@code TaskIdParams(String id, String tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: Drop {@code metadata} field, add {@code tenant} field (default to "")
  • + *
  • 1.0 → 0.3: Drop {@code tenant} field, add {@code metadata} field (set to null)
  • + *
+ * + * @see org.a2aproject.sdk.compat03.spec.TaskIdParams + * @see org.a2aproject.sdk.spec.TaskIdParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskIdParamsMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskIdParamsMapper INSTANCE = A03Mappers.getMapper(TaskIdParamsMapper.class); + + /** + * Converts v0.3 {@code TaskIdParams} to v1.0 {@code TaskIdParams}. + *

+ * The {@code metadata} field from v0.3 is dropped, and the v1.0 {@code tenant} field + * is set to the empty string default. + * + * @param v03 the v0.3 task ID params + * @return the equivalent v1.0 task ID params + */ + default org.a2aproject.sdk.spec.TaskIdParams toV10(org.a2aproject.sdk.compat03.spec.TaskIdParams v03) { + if (v03 == null) { + return null; + } + return new org.a2aproject.sdk.spec.TaskIdParams(v03.id(), ""); + } + + /** + * Converts v1.0 {@code TaskIdParams} to v0.3 {@code TaskIdParams}. + *

+ * The {@code tenant} field from v1.0 is dropped, and the v0.3 {@code metadata} field + * is set to null. + * + * @param v10 the v1.0 task ID params + * @return the equivalent v0.3 task ID params + */ + default org.a2aproject.sdk.compat03.spec.TaskIdParams fromV10(org.a2aproject.sdk.spec.TaskIdParams v10) { + if (v10 == null) { + return null; + } + return new org.a2aproject.sdk.compat03.spec.TaskIdParams(v10.id(), null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper.java new file mode 100644 index 000000000..8aa3fd691 --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/params/TaskQueryParamsMapper.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.params; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting {@code TaskQueryParams} between A2A Protocol v0.3 and v1.0. + *

+ * Key differences: + *

    + *
  • v0.3: {@code TaskQueryParams(String id, int historyLength, Map metadata)}
  • + *
  • v1.0: {@code TaskQueryParams(String id, Integer historyLength, String tenant)}
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • 0.3 → 1.0: + *
      + *
    • {@code historyLength}: primitive int → nullable Integer (0 → null)
    • + *
    • {@code metadata}: dropped
    • + *
    • {@code tenant}: added as ""
    • + *
    + *
  • + *
  • 1.0 → 0.3: + *
      + *
    • {@code historyLength}: nullable Integer → primitive int (null → 0)
    • + *
    • {@code metadata}: added as null
    • + *
    • {@code tenant}: dropped
    • + *
    + *
  • + *
+ * + * @see org.a2aproject.sdk.compat03.spec.TaskQueryParams + * @see org.a2aproject.sdk.spec.TaskQueryParams + */ +@Mapper(config = A03ToV10MapperConfig.class) +public interface TaskQueryParamsMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + TaskQueryParamsMapper INSTANCE = A03Mappers.getMapper(TaskQueryParamsMapper.class); + + /** + * Converts v0.3 {@code TaskQueryParams} to v1.0 {@code TaskQueryParams}. + *

+ * The {@code metadata} field from v0.3 is dropped, the {@code historyLength} is converted + * from primitive int to nullable Integer (0 becomes null), and the v1.0 {@code tenant} + * field is set to the empty string default. + * + * @param v03 the v0.3 task query params + * @return the equivalent v1.0 task query params + */ + default org.a2aproject.sdk.spec.TaskQueryParams toV10(org.a2aproject.sdk.compat03.spec.TaskQueryParams v03) { + if (v03 == null) { + return null; + } + // Convert historyLength: 0 (default) → null, non-zero → Integer + Integer historyLength = v03.historyLength() == 0 ? null : v03.historyLength(); + return new org.a2aproject.sdk.spec.TaskQueryParams(v03.id(), historyLength, ""); + } + + /** + * Converts v1.0 {@code TaskQueryParams} to v0.3 {@code TaskQueryParams}. + *

+ * The {@code tenant} field from v1.0 is dropped, the {@code historyLength} is converted + * from nullable Integer to primitive int (null becomes 0), and the v0.3 {@code metadata} + * field is set to null. + * + * @param v10 the v1.0 task query params + * @return the equivalent v0.3 task query params + */ + default org.a2aproject.sdk.compat03.spec.TaskQueryParams fromV10(org.a2aproject.sdk.spec.TaskQueryParams v10) { + if (v10 == null) { + return null; + } + // Convert historyLength: null → 0 (default), Integer → int + int historyLength = v10.historyLength() == null ? 0 : v10.historyLength(); + return new org.a2aproject.sdk.compat03.spec.TaskQueryParams(v10.id(), historyLength, null); + } +} diff --git a/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper.java b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper.java new file mode 100644 index 000000000..237e9628a --- /dev/null +++ b/compat-0.3/server-conversion/src/main/java/org/a2aproject/sdk/compat03/conversion/mappers/result/ListTaskPushNotificationConfigsResultMapper.java @@ -0,0 +1,77 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.result; + +import java.util.List; +import java.util.stream.Collectors; + +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03Mappers; +import org.a2aproject.sdk.compat03.conversion.mappers.config.A03ToV10MapperConfig; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskPushNotificationConfigMapper; +import org.a2aproject.sdk.spec.ListTaskPushNotificationConfigsResult; +import org.mapstruct.Mapper; + +/** + * Bidirectional mapper for converting between v0.3 {@code List} + * and v1.0 {@link ListTaskPushNotificationConfigsResult}. + *

+ * Key differences: + *

    + *
  • v0.3: Returns a plain {@code List} (no pagination support)
  • + *
  • v1.0: Returns {@link ListTaskPushNotificationConfigsResult} with pagination support (nextPageToken)
  • + *
+ *

+ * Conversion strategy: + *

    + *
  • v0.3 → v1.0: Wrap the list in {@code ListTaskPushNotificationConfigsResult} with no nextPageToken
  • + *
  • v1.0 → v0.3: Extract the configs list (discard nextPageToken as 0.3 doesn't support pagination)
  • + *
+ */ +@Mapper(config = A03ToV10MapperConfig.class, uses = {TaskPushNotificationConfigMapper.class}) +public interface ListTaskPushNotificationConfigsResultMapper { + + /** + * Singleton instance accessed via {@link A03Mappers} factory. + */ + ListTaskPushNotificationConfigsResultMapper INSTANCE = A03Mappers.getMapper(ListTaskPushNotificationConfigsResultMapper.class); + + /** + * Converts v0.3 {@code List} to v1.0 {@link ListTaskPushNotificationConfigsResult}. + *

+ * Wraps the list in a result object with no nextPageToken (pagination not supported in 0.3). + * Converts each TaskPushNotificationConfig using TaskPushNotificationConfigMapper. + * + * @param v03List the v0.3 list of task push notification configs + * @return the equivalent v1.0 result object + */ + default ListTaskPushNotificationConfigsResult toV10( + List v03List) { + if (v03List == null) { + return null; + } + + List v10Configs = v03List.stream() + .map(TaskPushNotificationConfigMapper.INSTANCE::toV10) + .collect(Collectors.toList()); + + return new ListTaskPushNotificationConfigsResult(v10Configs, null); + } + + /** + * Converts v1.0 {@link ListTaskPushNotificationConfigsResult} to v0.3 {@code List}. + *

+ * Extracts the configs list and discards the nextPageToken (pagination not supported in 0.3). + * Converts each TaskPushNotificationConfig using TaskPushNotificationConfigMapper. + * + * @param v10Result the v1.0 result object + * @return the equivalent v0.3 list + */ + default List fromV10( + ListTaskPushNotificationConfigsResult v10Result) { + if (v10Result == null) { + return null; + } + + return v10Result.configs().stream() + .map(TaskPushNotificationConfigMapper.INSTANCE::fromV10) + .collect(Collectors.toList()); + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest.java new file mode 100644 index 000000000..ac553254e --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/AbstractA2ARequestHandlerTest.java @@ -0,0 +1,287 @@ +package org.a2aproject.sdk.compat03.conversion; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; +import java.util.function.Consumer; + +import jakarta.enterprise.context.Dependent; + +import org.a2aproject.sdk.client.http.A2AHttpClient; +import org.a2aproject.sdk.client.http.A2AHttpResponse; +import org.a2aproject.sdk.jsonrpc.common.json.JsonProcessingException; +import org.a2aproject.sdk.jsonrpc.common.json.JsonUtil; +import org.a2aproject.sdk.server.agentexecution.AgentExecutor; +import org.a2aproject.sdk.server.agentexecution.RequestContext; +import org.a2aproject.sdk.server.events.EventQueueUtil; +import org.a2aproject.sdk.server.events.InMemoryQueueManager; +import org.a2aproject.sdk.server.events.MainEventBus; +import org.a2aproject.sdk.server.events.MainEventBusProcessor; +import org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler; +import org.a2aproject.sdk.server.tasks.AgentEmitter; +import org.a2aproject.sdk.server.tasks.BasePushNotificationSender; +import org.a2aproject.sdk.server.tasks.InMemoryPushNotificationConfigStore; +import org.a2aproject.sdk.server.tasks.InMemoryTaskStore; +import org.a2aproject.sdk.server.tasks.PushNotificationConfigStore; +import org.a2aproject.sdk.server.tasks.PushNotificationSender; +import org.a2aproject.sdk.server.tasks.TaskStore; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.StreamingEventKind; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import io.quarkus.arc.profile.IfBuildProfile; + +// V0.3 imports for test fixtures +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TextPart; + +/** + * Base test class for v0.3 transport handler tests. + *

+ * This class sets up the test infrastructure that bridges v0.3 transport handlers + * to the v1.0 backend via the {@link Convert03To10RequestHandler} conversion layer. + *

+ * + *

Architecture:

+ *
+ * Test (v0.3 types) → Handler (v0.3) → Convert03To10RequestHandler → v1.0 Backend
+ * 
+ * + *

Test fixtures:

+ * All test fixtures use v0.3 types ({@code org.a2aproject.sdk.compat03.spec.*}) + * to match the client perspective. + * + *

Backend:

+ * The backend uses v1.0 components ({@code org.a2aproject.sdk.server.*}) with + * the conversion happening transparently in {@link Convert03To10RequestHandler}. + */ +public abstract class AbstractA2ARequestHandlerTest { + + // V0.3 test fixtures (client perspective) + protected static final AgentCard CARD = createAgentCard(true, true, true); + + protected static final Task MINIMAL_TASK = new Task.Builder() + .id("task-123") + .contextId("session-xyz") + .status(new TaskStatus(TaskState.SUBMITTED)) + .build(); + + protected static final Message MESSAGE = new Message.Builder() + .messageId("111") + .role(Message.Role.AGENT) + .parts(new TextPart("test message")) + .build(); + + private static final PushNotificationSender NOOP_PUSHNOTIFICATION_SENDER = task -> {}; + + // V1.0 backend infrastructure + protected AgentExecutor agentExecutor; + protected TaskStore taskStore; + protected InMemoryQueueManager queueManager; + protected TestHttpClient httpClient; + protected MainEventBus mainEventBus; + protected MainEventBusProcessor mainEventBusProcessor; + + // V0.3 conversion layer (what transport handlers use) + protected Convert03To10RequestHandler convert03To10Handler; + + // Lambda injection for AgentExecutor behavior (v0.3.x pattern) + protected AgentExecutorMethod agentExecutorExecute; + protected AgentExecutorMethod agentExecutorCancel; + + protected final Executor internalExecutor = Executors.newCachedThreadPool(); + + @BeforeEach + public void init() { + // Create AgentExecutor with lambda injection (v1.0 interface) + agentExecutor = new AgentExecutor() { + @Override + public void execute(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + if (agentExecutorExecute != null) { + agentExecutorExecute.invoke(context, agentEmitter); + } + } + + @Override + public void cancel(RequestContext context, AgentEmitter agentEmitter) throws A2AError { + if (agentExecutorCancel != null) { + agentExecutorCancel.invoke(context, agentEmitter); + } + } + }; + + // Set up v1.0 backend components + InMemoryTaskStore inMemoryTaskStore = new InMemoryTaskStore(); + taskStore = inMemoryTaskStore; + + // Create push notification components BEFORE MainEventBusProcessor + httpClient = new TestHttpClient(); + PushNotificationConfigStore pushConfigStore = new InMemoryPushNotificationConfigStore(); + PushNotificationSender pushSender = new BasePushNotificationSender(pushConfigStore, httpClient); + + // Create MainEventBus and MainEventBusProcessor (production code path) + mainEventBus = new MainEventBus(); + queueManager = new InMemoryQueueManager(inMemoryTaskStore, mainEventBus); + mainEventBusProcessor = new MainEventBusProcessor(mainEventBus, taskStore, pushSender, queueManager); + EventQueueUtil.start(mainEventBusProcessor); + + // Create v1.0 DefaultRequestHandler + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, pushConfigStore, + mainEventBusProcessor, internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + convert03To10Handler = new Convert03To10RequestHandler(); + convert03To10Handler.v10Handler = v10Handler; + } + + @AfterEach + public void cleanup() { + agentExecutorExecute = null; + agentExecutorCancel = null; + + // Stop MainEventBusProcessor background thread + if (mainEventBusProcessor != null) { + EventQueueUtil.stop(mainEventBusProcessor); + } + } + + /** + * Creates a v0.3 AgentCard with specified capabilities. + * + * @param streaming whether streaming is supported + * @param pushNotifications whether push notifications are supported + * @param stateTransitionHistory whether state transition history is supported + * @return configured AgentCard + */ + protected static AgentCard createAgentCard(boolean streaming, boolean pushNotifications, + boolean stateTransitionHistory) { + return new AgentCard.Builder() + .name("test-card") + .description("A test agent card") + .url("http://example.com") + .version("1.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(streaming) + .pushNotifications(pushNotifications) + .stateTransitionHistory(stateTransitionHistory) + .build()) + .defaultInputModes(new ArrayList<>()) + .defaultOutputModes(new ArrayList<>()) + .preferredTransport("jsonrpc") + .skills(new ArrayList<>()) + .protocolVersion("0.3") + .build(); + } + + /** + * Lambda interface for AgentExecutor method injection in tests. + */ + protected interface AgentExecutorMethod { + void invoke(RequestContext context, AgentEmitter agentEmitter) throws A2AError; + } + + /** + * Test HTTP client for push notification testing. + * Captures posted events for verification. + */ + @Dependent + @IfBuildProfile("test") + protected static class TestHttpClient implements A2AHttpClient { + public final List events = Collections.synchronizedList(new ArrayList<>()); + public volatile CountDownLatch latch; + + @Override + public GetBuilder createGet() { + return null; + } + + @Override + public PostBuilder createPost() { + return new TestHttpClient.TestPostBuilder(); + } + + @Override + public DeleteBuilder createDelete() { + return null; + } + + class TestPostBuilder implements A2AHttpClient.PostBuilder { + private volatile String body; + + @Override + public PostBuilder body(String body) { + this.body = body; + return this; + } + + @Override + public A2AHttpResponse post() throws IOException, InterruptedException { + try { + // Parse StreamResponse format to extract the streaming event + // The body contains a wrapper with one of: task, message, statusUpdate, artifactUpdate + StreamingEventKind event = JsonUtil.fromJson(body, StreamingEventKind.class); + events.add(event); + return new A2AHttpResponse() { + @Override + public int status() { + return 200; + } + + @Override + public boolean success() { + return true; + } + + @Override + public String body() { + return ""; + } + }; + } catch (JsonProcessingException e) { + throw new IOException("Failed to parse StreamingEventKind JSON", e); + } finally { + if (latch != null) { + latch.countDown(); + } + } + } + + @Override + public CompletableFuture postAsyncSSE(Consumer messageConsumer, + Consumer errorConsumer, + Runnable completeRunnable) + throws IOException, InterruptedException { + return null; + } + + @Override + public PostBuilder url(String s) { + return this; + } + + @Override + public PostBuilder addHeader(String name, String value) { + return this; + } + + @Override + public PostBuilder addHeaders(Map headers) { + return this; + } + } + } +} diff --git a/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapperTest.java b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapperTest.java new file mode 100644 index 000000000..acc1e2fca --- /dev/null +++ b/compat-0.3/server-conversion/src/test/java/org/a2aproject/sdk/compat03/conversion/mappers/domain/TaskMapperTest.java @@ -0,0 +1,179 @@ +package org.a2aproject.sdk.compat03.conversion.mappers.domain; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.spec.Task; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +/** + * Test for {@link TaskMapper} to verify conversion of fully populated Task objects + * between v0.3 and v1.0 protocol versions. + */ +class TaskMapperTest { + + @Test + void testFullyPopulatedTaskConversion() { + // Create a fully populated v0.3 Task + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + + org.a2aproject.sdk.compat03.spec.Message v03Message = new org.a2aproject.sdk.compat03.spec.Message( + org.a2aproject.sdk.compat03.spec.Message.Role.USER, + List.of(new org.a2aproject.sdk.compat03.spec.TextPart("Hello, agent!")), + "msg-001", + "ctx-001", + "task-001", + List.of("ref-task-001"), + Map.of("key", "value"), + List.of("ext1") + ); + + org.a2aproject.sdk.compat03.spec.TaskStatus v03Status = new org.a2aproject.sdk.compat03.spec.TaskStatus( + org.a2aproject.sdk.compat03.spec.TaskState.WORKING, + v03Message, + now + ); + + org.a2aproject.sdk.compat03.spec.Artifact v03Artifact = new org.a2aproject.sdk.compat03.spec.Artifact( + "artifact-001", + "Test Artifact", + "A test artifact", + List.of( + new org.a2aproject.sdk.compat03.spec.TextPart("Response text"), + new org.a2aproject.sdk.compat03.spec.DataPart(Map.of("result", "success")) + ), + Map.of("artifactMeta", "value"), + List.of("artifactExt") + ); + + org.a2aproject.sdk.compat03.spec.Message v03HistoryMessage = new org.a2aproject.sdk.compat03.spec.Message( + org.a2aproject.sdk.compat03.spec.Message.Role.AGENT, + List.of(new org.a2aproject.sdk.compat03.spec.TextPart("Agent response")), + "msg-002", + "ctx-001", + "task-001", + null, + null, + null + ); + + org.a2aproject.sdk.compat03.spec.Task v03Task = new org.a2aproject.sdk.compat03.spec.Task( + "task-001", + "ctx-001", + v03Status, + List.of(v03Artifact), + List.of(v03HistoryMessage), + Map.of("taskMeta", "taskValue") + ); + + // Convert v0.3 → v1.0 + Task v10Task = TaskMapper.INSTANCE.toV10(v03Task); + + // Verify v1.0 Task + assertNotNull(v10Task); + assertEquals("task-001", v10Task.id()); + assertEquals("ctx-001", v10Task.contextId()); + assertEquals(Map.of("taskMeta", "taskValue"), v10Task.metadata()); + + // Verify status conversion + assertNotNull(v10Task.status()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_WORKING, v10Task.status().state()); + assertEquals(now, v10Task.status().timestamp()); + + // Verify status message conversion + assertNotNull(v10Task.status().message()); + assertEquals(org.a2aproject.sdk.spec.Message.Role.ROLE_USER, v10Task.status().message().role()); + assertEquals("msg-001", v10Task.status().message().messageId()); + assertEquals("ctx-001", v10Task.status().message().contextId()); + assertEquals("task-001", v10Task.status().message().taskId()); + assertEquals(1, v10Task.status().message().parts().size()); + assertEquals("Hello, agent!", ((org.a2aproject.sdk.spec.TextPart) v10Task.status().message().parts().get(0)).text()); + + // Verify artifacts conversion + assertNotNull(v10Task.artifacts()); + assertEquals(1, v10Task.artifacts().size()); + org.a2aproject.sdk.spec.Artifact v10Artifact = v10Task.artifacts().get(0); + assertEquals("artifact-001", v10Artifact.artifactId()); + assertEquals("Test Artifact", v10Artifact.name()); + assertEquals("A test artifact", v10Artifact.description()); + assertEquals(2, v10Artifact.parts().size()); + assertEquals("Response text", ((org.a2aproject.sdk.spec.TextPart) v10Artifact.parts().get(0)).text()); + + // Verify history conversion + assertNotNull(v10Task.history()); + assertEquals(1, v10Task.history().size()); + org.a2aproject.sdk.spec.Message v10HistoryMsg = v10Task.history().get(0); + assertEquals(org.a2aproject.sdk.spec.Message.Role.ROLE_AGENT, v10HistoryMsg.role()); + assertEquals("msg-002", v10HistoryMsg.messageId()); + assertEquals("Agent response", ((org.a2aproject.sdk.spec.TextPart) v10HistoryMsg.parts().get(0)).text()); + + // Convert v1.0 → v0.3 (round trip) + org.a2aproject.sdk.compat03.spec.Task v03TaskRoundTrip = TaskMapper.INSTANCE.fromV10(v10Task); + + // Verify round-trip conversion + assertNotNull(v03TaskRoundTrip); + assertEquals("task-001", v03TaskRoundTrip.getId()); + assertEquals("ctx-001", v03TaskRoundTrip.getContextId()); + assertEquals(org.a2aproject.sdk.compat03.spec.TaskState.WORKING, v03TaskRoundTrip.getStatus().state()); + assertEquals("msg-001", v03TaskRoundTrip.getStatus().message().getMessageId()); + assertEquals(1, v03TaskRoundTrip.getArtifacts().size()); + assertEquals("artifact-001", v03TaskRoundTrip.getArtifacts().get(0).artifactId()); + assertEquals(1, v03TaskRoundTrip.getHistory().size()); + assertEquals("msg-002", v03TaskRoundTrip.getHistory().get(0).getMessageId()); + } + + @Test + void testMinimalTaskConversion() { + // Test with minimal Task (no artifacts, no history, no metadata) + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + + org.a2aproject.sdk.compat03.spec.TaskStatus v03Status = new org.a2aproject.sdk.compat03.spec.TaskStatus( + org.a2aproject.sdk.compat03.spec.TaskState.SUBMITTED + ); + + org.a2aproject.sdk.compat03.spec.Task v03Task = new org.a2aproject.sdk.compat03.spec.Task( + "task-minimal", + "ctx-minimal", + v03Status, + null, + null, + null + ); + + // Convert v0.3 → v1.0 + Task v10Task = TaskMapper.INSTANCE.toV10(v03Task); + + // Verify minimal conversion + assertNotNull(v10Task); + assertEquals("task-minimal", v10Task.id()); + assertEquals("ctx-minimal", v10Task.contextId()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_SUBMITTED, v10Task.status().state()); + assertNull(v10Task.status().message()); + + // v1.0 Task compact constructor converts null to empty list + assertNotNull(v10Task.artifacts()); + assertEquals(0, v10Task.artifacts().size()); + assertNotNull(v10Task.history()); + assertEquals(0, v10Task.history().size()); + assertNull(v10Task.metadata()); + + // Round trip + org.a2aproject.sdk.compat03.spec.Task v03TaskRoundTrip = TaskMapper.INSTANCE.fromV10(v10Task); + assertNotNull(v03TaskRoundTrip); + assertEquals("task-minimal", v03TaskRoundTrip.getId()); + assertEquals(org.a2aproject.sdk.compat03.spec.TaskState.SUBMITTED, v03TaskRoundTrip.getStatus().state()); + } + + @Test + void testNullTaskConversion() { + // Null safety + assertNull(TaskMapper.INSTANCE.toV10(null)); + assertNull(TaskMapper.INSTANCE.fromV10(null)); + } +} diff --git a/compat-0.3/spec-grpc/pom.xml b/compat-0.3/spec-grpc/pom.xml new file mode 100644 index 000000000..a0da63d5e --- /dev/null +++ b/compat-0.3/spec-grpc/pom.xml @@ -0,0 +1,147 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-spec-grpc + + jar + + Java SDK A2A Compat 0.3 Spec: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - Spec: gRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + provided + + + io.grpc + grpc-stub + provided + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + com.google.api.grpc + proto-google-common-protos + + + + + javax.annotation + javax.annotation-api + provided + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + + kr.motd.maven + os-maven-plugin + ${os-maven-plugin.version} + + + + + + + proto-compile + + + + + org.apache.maven.plugins + maven-clean-plugin + ${maven-clean-plugin.version} + + + remove-generated-files + initialize + + clean + + + true + + + ${project.basedir}/src/main/java/io/a2a/grpc + false + + *.java + + + + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + ${protobuf-maven-plugin.version} + + com.google.protobuf:protoc:${protobuf-java.version}:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + src/main/java + false + + + + + compile + compile-custom + + + + + + + + + + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java new file mode 100644 index 000000000..cbed7cc2c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2A.java @@ -0,0 +1,827 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public final class A2A extends com.google.protobuf.GeneratedFile { + private A2A() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "A2A"); + } + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageConfiguration_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Task_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Task_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskStatus_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Part_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Part_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_FilePart_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_FilePart_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_DataPart_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_DataPart_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Message_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Message_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Artifact_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Artifact_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PushNotificationConfig_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthenticationInfo_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentInterface_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentInterface_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCard_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCard_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentProvider_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentProvider_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCapabilities_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentExtension_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentExtension_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentSkill_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentSkill_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AgentCardSignature_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_StringList_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_StringList_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Security_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Security_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_Security_SchemesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_Security_SchemesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_OAuthFlows_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_OAuthFlows_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetTaskRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_CancelTaskRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_GetAgentCardRequest_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_SendMessageResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_StreamResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_StreamResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + static final + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\ta2a.proto\022\006a2a.v1\032\034google/api/annotati" + + "ons.proto\032\027google/api/client.proto\032\037goog" + + "le/api/field_behavior.proto\032\033google/prot" + + "obuf/empty.proto\032\034google/protobuf/struct" + + ".proto\032\037google/protobuf/timestamp.proto\"" + + "\236\001\n\030SendMessageConfiguration\022\035\n\025accepted" + + "_output_modes\030\001 \003(\t\0229\n\021push_notification" + + "\030\002 \001(\0132\036.a2a.v1.PushNotificationConfig\022\026" + + "\n\016history_length\030\003 \001(\005\022\020\n\010blocking\030\004 \001(\010" + + "\"\274\001\n\004Task\022\n\n\002id\030\001 \001(\t\022\022\n\ncontext_id\030\002 \001(" + + "\t\022\"\n\006status\030\003 \001(\0132\022.a2a.v1.TaskStatus\022#\n" + + "\tartifacts\030\004 \003(\0132\020.a2a.v1.Artifact\022 \n\007hi" + + "story\030\005 \003(\0132\017.a2a.v1.Message\022)\n\010metadata" + + "\030\006 \001(\0132\027.google.protobuf.Struct\"\207\001\n\nTask" + + "Status\022 \n\005state\030\001 \001(\0162\021.a2a.v1.TaskState" + + "\022(\n\006update\030\002 \001(\0132\017.a2a.v1.MessageR\007messa" + + "ge\022-\n\ttimestamp\030\003 \001(\0132\032.google.protobuf." + + "Timestamp\"b\n\004Part\022\016\n\004text\030\001 \001(\tH\000\022 \n\004fil" + + "e\030\002 \001(\0132\020.a2a.v1.FilePartH\000\022 \n\004data\030\003 \001(" + + "\0132\020.a2a.v1.DataPartH\000B\006\n\004part\"Y\n\010FilePar" + + "t\022\027\n\rfile_with_uri\030\001 \001(\tH\000\022\031\n\017file_with_" + + "bytes\030\002 \001(\014H\000\022\021\n\tmime_type\030\003 \001(\tB\006\n\004file" + + "\"1\n\010DataPart\022%\n\004data\030\001 \001(\0132\027.google.prot" + + "obuf.Struct\"\274\001\n\007Message\022\022\n\nmessage_id\030\001 " + + "\001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\017\n\007task_id\030\003 \001(\t" + + "\022\032\n\004role\030\004 \001(\0162\014.a2a.v1.Role\022\035\n\007content\030" + + "\005 \003(\0132\014.a2a.v1.Part\022)\n\010metadata\030\006 \001(\0132\027." + + "google.protobuf.Struct\022\022\n\nextensions\030\007 \003" + + "(\t\"\236\001\n\010Artifact\022\023\n\013artifact_id\030\001 \001(\t\022\014\n\004" + + "name\030\003 \001(\t\022\023\n\013description\030\004 \001(\t\022\033\n\005parts" + + "\030\005 \003(\0132\014.a2a.v1.Part\022)\n\010metadata\030\006 \001(\0132\027" + + ".google.protobuf.Struct\022\022\n\nextensions\030\007 " + + "\003(\t\"\232\001\n\025TaskStatusUpdateEvent\022\017\n\007task_id" + + "\030\001 \001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\"\n\006status\030\003 \001" + + "(\0132\022.a2a.v1.TaskStatus\022\r\n\005final\030\004 \001(\010\022)\n" + + "\010metadata\030\005 \001(\0132\027.google.protobuf.Struct" + + "\"\261\001\n\027TaskArtifactUpdateEvent\022\017\n\007task_id\030" + + "\001 \001(\t\022\022\n\ncontext_id\030\002 \001(\t\022\"\n\010artifact\030\003 " + + "\001(\0132\020.a2a.v1.Artifact\022\016\n\006append\030\004 \001(\010\022\022\n" + + "\nlast_chunk\030\005 \001(\010\022)\n\010metadata\030\006 \001(\0132\027.go" + + "ogle.protobuf.Struct\"t\n\026PushNotification" + + "Config\022\n\n\002id\030\001 \001(\t\022\013\n\003url\030\002 \001(\t\022\r\n\005token" + + "\030\003 \001(\t\0222\n\016authentication\030\004 \001(\0132\032.a2a.v1." + + "AuthenticationInfo\":\n\022AuthenticationInfo" + + "\022\017\n\007schemes\030\001 \003(\t\022\023\n\013credentials\030\002 \001(\t\"0" + + "\n\016AgentInterface\022\013\n\003url\030\001 \001(\t\022\021\n\ttranspo" + + "rt\030\002 \001(\t\"\242\005\n\tAgentCard\022\030\n\020protocol_versi" + + "on\030\020 \001(\t\022\014\n\004name\030\001 \001(\t\022\023\n\013description\030\002 " + + "\001(\t\022\013\n\003url\030\003 \001(\t\022\033\n\023preferred_transport\030" + + "\016 \001(\t\0225\n\025additional_interfaces\030\017 \003(\0132\026.a" + + "2a.v1.AgentInterface\022\'\n\010provider\030\004 \001(\0132\025" + + ".a2a.v1.AgentProvider\022\017\n\007version\030\005 \001(\t\022\031" + + "\n\021documentation_url\030\006 \001(\t\022/\n\014capabilitie" + + "s\030\007 \001(\0132\031.a2a.v1.AgentCapabilities\022@\n\020se" + + "curity_schemes\030\010 \003(\0132&.a2a.v1.AgentCard." + + "SecuritySchemesEntry\022\"\n\010security\030\t \003(\0132\020" + + ".a2a.v1.Security\022\033\n\023default_input_modes\030" + + "\n \003(\t\022\034\n\024default_output_modes\030\013 \003(\t\022\"\n\006s" + + "kills\030\014 \003(\0132\022.a2a.v1.AgentSkill\022,\n$suppo" + + "rts_authenticated_extended_card\030\r \001(\010\022.\n" + + "\nsignatures\030\021 \003(\0132\032.a2a.v1.AgentCardSign" + + "ature\032N\n\024SecuritySchemesEntry\022\013\n\003key\030\001 \001" + + "(\t\022%\n\005value\030\002 \001(\0132\026.a2a.v1.SecuritySchem" + + "e:\0028\001\"2\n\rAgentProvider\022\013\n\003url\030\001 \001(\t\022\024\n\014o" + + "rganization\030\002 \001(\t\"n\n\021AgentCapabilities\022\021" + + "\n\tstreaming\030\001 \001(\010\022\032\n\022push_notifications\030" + + "\002 \001(\010\022*\n\nextensions\030\003 \003(\0132\026.a2a.v1.Agent" + + "Extension\"m\n\016AgentExtension\022\013\n\003uri\030\001 \001(\t" + + "\022\023\n\013description\030\002 \001(\t\022\020\n\010required\030\003 \001(\010\022" + + "\'\n\006params\030\004 \001(\0132\027.google.protobuf.Struct" + + "\"\252\001\n\nAgentSkill\022\n\n\002id\030\001 \001(\t\022\014\n\004name\030\002 \001(" + + "\t\022\023\n\013description\030\003 \001(\t\022\014\n\004tags\030\004 \003(\t\022\020\n\010" + + "examples\030\005 \003(\t\022\023\n\013input_modes\030\006 \003(\t\022\024\n\014o" + + "utput_modes\030\007 \003(\t\022\"\n\010security\030\010 \003(\0132\020.a2" + + "a.v1.Security\"m\n\022AgentCardSignature\022\026\n\tp" + + "rotected\030\001 \001(\tB\003\340A\002\022\026\n\tsignature\030\002 \001(\tB\003" + + "\340A\002\022\'\n\006header\030\003 \001(\0132\027.google.protobuf.St" + + "ruct\"l\n\032TaskPushNotificationConfig\022\014\n\004na" + + "me\030\001 \001(\t\022@\n\030push_notification_config\030\002 \001" + + "(\0132\036.a2a.v1.PushNotificationConfig\"\032\n\nSt" + + "ringList\022\014\n\004list\030\001 \003(\t\"~\n\010Security\022.\n\007sc" + + "hemes\030\001 \003(\0132\035.a2a.v1.Security.SchemesEnt" + + "ry\032B\n\014SchemesEntry\022\013\n\003key\030\001 \001(\t\022!\n\005value" + + "\030\002 \001(\0132\022.a2a.v1.StringList:\0028\001\"\361\002\n\016Secur" + + "ityScheme\022?\n\027api_key_security_scheme\030\001 \001" + + "(\0132\034.a2a.v1.APIKeySecuritySchemeH\000\022C\n\031ht" + + "tp_auth_security_scheme\030\002 \001(\0132\036.a2a.v1.H" + + "TTPAuthSecuritySchemeH\000\022>\n\026oauth2_securi" + + "ty_scheme\030\003 \001(\0132\034.a2a.v1.OAuth2SecurityS" + + "chemeH\000\022N\n\037open_id_connect_security_sche" + + "me\030\004 \001(\0132#.a2a.v1.OpenIdConnectSecurityS" + + "chemeH\000\022?\n\024mtls_security_scheme\030\005 \001(\0132\037." + + "a2a.v1.MutualTlsSecuritySchemeH\000B\010\n\006sche" + + "me\"K\n\024APIKeySecurityScheme\022\023\n\013descriptio" + + "n\030\001 \001(\t\022\020\n\010location\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\"" + + "T\n\026HTTPAuthSecurityScheme\022\023\n\013description" + + "\030\001 \001(\t\022\016\n\006scheme\030\002 \001(\t\022\025\n\rbearer_format\030" + + "\003 \001(\t\"k\n\024OAuth2SecurityScheme\022\023\n\013descrip" + + "tion\030\001 \001(\t\022!\n\005flows\030\002 \001(\0132\022.a2a.v1.OAuth" + + "Flows\022\033\n\023oauth2_metadata_url\030\003 \001(\t\"O\n\033Op" + + "enIdConnectSecurityScheme\022\023\n\013description" + + "\030\001 \001(\t\022\033\n\023open_id_connect_url\030\002 \001(\t\".\n\027M" + + "utualTlsSecurityScheme\022\023\n\013description\030\001 " + + "\001(\t\"\366\001\n\nOAuthFlows\022@\n\022authorization_code" + + "\030\001 \001(\0132\".a2a.v1.AuthorizationCodeOAuthFl" + + "owH\000\022@\n\022client_credentials\030\002 \001(\0132\".a2a.v" + + "1.ClientCredentialsOAuthFlowH\000\022-\n\010implic" + + "it\030\003 \001(\0132\031.a2a.v1.ImplicitOAuthFlowH\000\022-\n" + + "\010password\030\004 \001(\0132\031.a2a.v1.PasswordOAuthFl" + + "owH\000B\006\n\004flow\"\316\001\n\032AuthorizationCodeOAuthF" + + "low\022\031\n\021authorization_url\030\001 \001(\t\022\021\n\ttoken_" + + "url\030\002 \001(\t\022\023\n\013refresh_url\030\003 \001(\t\022>\n\006scopes" + + "\030\004 \003(\0132..a2a.v1.AuthorizationCodeOAuthFl" + + "ow.ScopesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001" + + "(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"\263\001\n\032ClientCredenti" + + "alsOAuthFlow\022\021\n\ttoken_url\030\001 \001(\t\022\023\n\013refre" + + "sh_url\030\002 \001(\t\022>\n\006scopes\030\003 \003(\0132..a2a.v1.Cl" + + "ientCredentialsOAuthFlow.ScopesEntry\032-\n\013" + + "ScopesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" + + "\0028\001\"\251\001\n\021ImplicitOAuthFlow\022\031\n\021authorizati" + + "on_url\030\001 \001(\t\022\023\n\013refresh_url\030\002 \001(\t\0225\n\006sco" + + "pes\030\003 \003(\0132%.a2a.v1.ImplicitOAuthFlow.Sco" + + "pesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005" + + "value\030\002 \001(\t:\0028\001\"\241\001\n\021PasswordOAuthFlow\022\021\n" + + "\ttoken_url\030\001 \001(\t\022\023\n\013refresh_url\030\002 \001(\t\0225\n" + + "\006scopes\030\003 \003(\0132%.a2a.v1.PasswordOAuthFlow" + + ".ScopesEntry\032-\n\013ScopesEntry\022\013\n\003key\030\001 \001(\t" + + "\022\r\n\005value\030\002 \001(\t:\0028\001\"\250\001\n\022SendMessageReque" + + "st\022.\n\007request\030\001 \001(\0132\017.a2a.v1.MessageB\003\340A" + + "\002R\007message\0227\n\rconfiguration\030\002 \001(\0132 .a2a." + + "v1.SendMessageConfiguration\022)\n\010metadata\030" + + "\003 \001(\0132\027.google.protobuf.Struct\";\n\016GetTas" + + "kRequest\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\026\n\016history_l" + + "ength\030\002 \001(\005\"!\n\021CancelTaskRequest\022\014\n\004name" + + "\030\001 \001(\t\"4\n$GetTaskPushNotificationConfigR" + + "equest\022\014\n\004name\030\001 \001(\t\"7\n\'DeleteTaskPushNo" + + "tificationConfigRequest\022\014\n\004name\030\001 \001(\t\"\217\001" + + "\n\'CreateTaskPushNotificationConfigReques" + + "t\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\026\n\tconfig_id\030\002 \001(" + + "\tB\003\340A\002\0227\n\006config\030\003 \001(\0132\".a2a.v1.TaskPush" + + "NotificationConfigB\003\340A\002\"\'\n\027TaskSubscript" + + "ionRequest\022\014\n\004name\030\001 \001(\t\"^\n%ListTaskPush" + + "NotificationConfigRequest\022\016\n\006parent\030\001 \001(" + + "\t\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t" + + "\"\025\n\023GetAgentCardRequest\"g\n\023SendMessageRe" + + "sponse\022\034\n\004task\030\001 \001(\0132\014.a2a.v1.TaskH\000\022\'\n\003" + + "msg\030\002 \001(\0132\017.a2a.v1.MessageH\000R\007messageB\t\n" + + "\007payload\"\326\001\n\016StreamResponse\022\034\n\004task\030\001 \001(" + + "\0132\014.a2a.v1.TaskH\000\022\'\n\003msg\030\002 \001(\0132\017.a2a.v1." + + "MessageH\000R\007message\0226\n\rstatus_update\030\003 \001(" + + "\0132\035.a2a.v1.TaskStatusUpdateEventH\000\022:\n\017ar" + + "tifact_update\030\004 \001(\0132\037.a2a.v1.TaskArtifac" + + "tUpdateEventH\000B\t\n\007payload\"v\n&ListTaskPus" + + "hNotificationConfigResponse\0223\n\007configs\030\001" + + " \003(\0132\".a2a.v1.TaskPushNotificationConfig" + + "\022\027\n\017next_page_token\030\002 \001(\t*\372\001\n\tTaskState\022" + + "\032\n\026TASK_STATE_UNSPECIFIED\020\000\022\030\n\024TASK_STAT" + + "E_SUBMITTED\020\001\022\026\n\022TASK_STATE_WORKING\020\002\022\030\n" + + "\024TASK_STATE_COMPLETED\020\003\022\025\n\021TASK_STATE_FA" + + "ILED\020\004\022\030\n\024TASK_STATE_CANCELLED\020\005\022\035\n\031TASK" + + "_STATE_INPUT_REQUIRED\020\006\022\027\n\023TASK_STATE_RE" + + "JECTED\020\007\022\034\n\030TASK_STATE_AUTH_REQUIRED\020\010*;" + + "\n\004Role\022\024\n\020ROLE_UNSPECIFIED\020\000\022\r\n\tROLE_USE" + + "R\020\001\022\016\n\nROLE_AGENT\020\0022\272\n\n\nA2AService\022c\n\013Se" + + "ndMessage\022\032.a2a.v1.SendMessageRequest\032\033." + + "a2a.v1.SendMessageResponse\"\033\202\323\344\223\002\025\"\020/v1/" + + "message:send:\001*\022k\n\024SendStreamingMessage\022" + + "\032.a2a.v1.SendMessageRequest\032\026.a2a.v1.Str" + + "eamResponse\"\035\202\323\344\223\002\027\"\022/v1/message:stream:" + + "\001*0\001\022R\n\007GetTask\022\026.a2a.v1.GetTaskRequest\032" + + "\014.a2a.v1.Task\"!\332A\004name\202\323\344\223\002\024\022\022/v1/{name=" + + "tasks/*}\022[\n\nCancelTask\022\031.a2a.v1.CancelTa" + + "skRequest\032\014.a2a.v1.Task\"$\202\323\344\223\002\036\"\031/v1/{na" + + "me=tasks/*}:cancel:\001*\022s\n\020TaskSubscriptio" + + "n\022\037.a2a.v1.TaskSubscriptionRequest\032\026.a2a" + + ".v1.StreamResponse\"$\202\323\344\223\002\036\022\034/v1/{name=ta" + + "sks/*}:subscribe0\001\022\304\001\n CreateTaskPushNot" + + "ificationConfig\022/.a2a.v1.CreateTaskPushN" + + "otificationConfigRequest\032\".a2a.v1.TaskPu" + + "shNotificationConfig\"K\332A\rparent,config\202\323" + + "\344\223\0025\"+/v1/{parent=task/*/pushNotificatio" + + "nConfigs}:\006config\022\256\001\n\035GetTaskPushNotific" + + "ationConfig\022,.a2a.v1.GetTaskPushNotifica" + + "tionConfigRequest\032\".a2a.v1.TaskPushNotif" + + "icationConfig\";\332A\004name\202\323\344\223\002.\022,/v1/{name=" + + "tasks/*/pushNotificationConfigs/*}\022\276\001\n\036L" + + "istTaskPushNotificationConfig\022-.a2a.v1.L" + + "istTaskPushNotificationConfigRequest\032..a" + + "2a.v1.ListTaskPushNotificationConfigResp" + + "onse\"=\332A\006parent\202\323\344\223\002.\022,/v1/{parent=tasks" + + "/*}/pushNotificationConfigs\022P\n\014GetAgentC" + + "ard\022\033.a2a.v1.GetAgentCardRequest\032\021.a2a.v" + + "1.AgentCard\"\020\202\323\344\223\002\n\022\010/v1/card\022\250\001\n Delete" + + "TaskPushNotificationConfig\022/.a2a.v1.Dele" + + "teTaskPushNotificationConfigRequest\032\026.go" + + "ogle.protobuf.Empty\";\332A\004name\202\323\344\223\002.*,/v1/" + + "{name=tasks/*/pushNotificationConfigs/*}" + + "BL\n org.a2aproject.sdk.compat03.grpcB\003A2" + + "AP\001Z\030google.golang.org/a2a/v1\252\002\006A2a.V1b\006" + + "proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_a2a_v1_SendMessageConfiguration_descriptor = + getDescriptor().getMessageType(0); + internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageConfiguration_descriptor, + new java.lang.String[] { "AcceptedOutputModes", "PushNotification", "HistoryLength", "Blocking", }); + internal_static_a2a_v1_Task_descriptor = + getDescriptor().getMessageType(1); + internal_static_a2a_v1_Task_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Task_descriptor, + new java.lang.String[] { "Id", "ContextId", "Status", "Artifacts", "History", "Metadata", }); + internal_static_a2a_v1_TaskStatus_descriptor = + getDescriptor().getMessageType(2); + internal_static_a2a_v1_TaskStatus_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskStatus_descriptor, + new java.lang.String[] { "State", "Update", "Timestamp", }); + internal_static_a2a_v1_Part_descriptor = + getDescriptor().getMessageType(3); + internal_static_a2a_v1_Part_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Part_descriptor, + new java.lang.String[] { "Text", "File", "Data", "Part", }); + internal_static_a2a_v1_FilePart_descriptor = + getDescriptor().getMessageType(4); + internal_static_a2a_v1_FilePart_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_FilePart_descriptor, + new java.lang.String[] { "FileWithUri", "FileWithBytes", "MimeType", "File", }); + internal_static_a2a_v1_DataPart_descriptor = + getDescriptor().getMessageType(5); + internal_static_a2a_v1_DataPart_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_DataPart_descriptor, + new java.lang.String[] { "Data", }); + internal_static_a2a_v1_Message_descriptor = + getDescriptor().getMessageType(6); + internal_static_a2a_v1_Message_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Message_descriptor, + new java.lang.String[] { "MessageId", "ContextId", "TaskId", "Role", "Content", "Metadata", "Extensions", }); + internal_static_a2a_v1_Artifact_descriptor = + getDescriptor().getMessageType(7); + internal_static_a2a_v1_Artifact_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Artifact_descriptor, + new java.lang.String[] { "ArtifactId", "Name", "Description", "Parts", "Metadata", "Extensions", }); + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor = + getDescriptor().getMessageType(8); + internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor, + new java.lang.String[] { "TaskId", "ContextId", "Status", "Final", "Metadata", }); + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor = + getDescriptor().getMessageType(9); + internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor, + new java.lang.String[] { "TaskId", "ContextId", "Artifact", "Append", "LastChunk", "Metadata", }); + internal_static_a2a_v1_PushNotificationConfig_descriptor = + getDescriptor().getMessageType(10); + internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PushNotificationConfig_descriptor, + new java.lang.String[] { "Id", "Url", "Token", "Authentication", }); + internal_static_a2a_v1_AuthenticationInfo_descriptor = + getDescriptor().getMessageType(11); + internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthenticationInfo_descriptor, + new java.lang.String[] { "Schemes", "Credentials", }); + internal_static_a2a_v1_AgentInterface_descriptor = + getDescriptor().getMessageType(12); + internal_static_a2a_v1_AgentInterface_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentInterface_descriptor, + new java.lang.String[] { "Url", "Transport", }); + internal_static_a2a_v1_AgentCard_descriptor = + getDescriptor().getMessageType(13); + internal_static_a2a_v1_AgentCard_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCard_descriptor, + new java.lang.String[] { "ProtocolVersion", "Name", "Description", "Url", "PreferredTransport", "AdditionalInterfaces", "Provider", "Version", "DocumentationUrl", "Capabilities", "SecuritySchemes", "Security", "DefaultInputModes", "DefaultOutputModes", "Skills", "SupportsAuthenticatedExtendedCard", "Signatures", }); + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor = + internal_static_a2a_v1_AgentCard_descriptor.getNestedType(0); + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_AgentProvider_descriptor = + getDescriptor().getMessageType(14); + internal_static_a2a_v1_AgentProvider_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentProvider_descriptor, + new java.lang.String[] { "Url", "Organization", }); + internal_static_a2a_v1_AgentCapabilities_descriptor = + getDescriptor().getMessageType(15); + internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCapabilities_descriptor, + new java.lang.String[] { "Streaming", "PushNotifications", "Extensions", }); + internal_static_a2a_v1_AgentExtension_descriptor = + getDescriptor().getMessageType(16); + internal_static_a2a_v1_AgentExtension_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentExtension_descriptor, + new java.lang.String[] { "Uri", "Description", "Required", "Params", }); + internal_static_a2a_v1_AgentSkill_descriptor = + getDescriptor().getMessageType(17); + internal_static_a2a_v1_AgentSkill_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentSkill_descriptor, + new java.lang.String[] { "Id", "Name", "Description", "Tags", "Examples", "InputModes", "OutputModes", "Security", }); + internal_static_a2a_v1_AgentCardSignature_descriptor = + getDescriptor().getMessageType(18); + internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AgentCardSignature_descriptor, + new java.lang.String[] { "Protected", "Signature", "Header", }); + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor = + getDescriptor().getMessageType(19); + internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskPushNotificationConfig_descriptor, + new java.lang.String[] { "Name", "PushNotificationConfig", }); + internal_static_a2a_v1_StringList_descriptor = + getDescriptor().getMessageType(20); + internal_static_a2a_v1_StringList_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_StringList_descriptor, + new java.lang.String[] { "List", }); + internal_static_a2a_v1_Security_descriptor = + getDescriptor().getMessageType(21); + internal_static_a2a_v1_Security_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Security_descriptor, + new java.lang.String[] { "Schemes", }); + internal_static_a2a_v1_Security_SchemesEntry_descriptor = + internal_static_a2a_v1_Security_descriptor.getNestedType(0); + internal_static_a2a_v1_Security_SchemesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_Security_SchemesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_SecurityScheme_descriptor = + getDescriptor().getMessageType(22); + internal_static_a2a_v1_SecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SecurityScheme_descriptor, + new java.lang.String[] { "ApiKeySecurityScheme", "HttpAuthSecurityScheme", "Oauth2SecurityScheme", "OpenIdConnectSecurityScheme", "MtlsSecurityScheme", "Scheme", }); + internal_static_a2a_v1_APIKeySecurityScheme_descriptor = + getDescriptor().getMessageType(23); + internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_APIKeySecurityScheme_descriptor, + new java.lang.String[] { "Description", "Location", "Name", }); + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor = + getDescriptor().getMessageType(24); + internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor, + new java.lang.String[] { "Description", "Scheme", "BearerFormat", }); + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor = + getDescriptor().getMessageType(25); + internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OAuth2SecurityScheme_descriptor, + new java.lang.String[] { "Description", "Flows", "Oauth2MetadataUrl", }); + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor = + getDescriptor().getMessageType(26); + internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor, + new java.lang.String[] { "Description", "OpenIdConnectUrl", }); + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor = + getDescriptor().getMessageType(27); + internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor, + new java.lang.String[] { "Description", }); + internal_static_a2a_v1_OAuthFlows_descriptor = + getDescriptor().getMessageType(28); + internal_static_a2a_v1_OAuthFlows_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_OAuthFlows_descriptor, + new java.lang.String[] { "AuthorizationCode", "ClientCredentials", "Implicit", "Password", "Flow", }); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor = + getDescriptor().getMessageType(29); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor, + new java.lang.String[] { "AuthorizationUrl", "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor = + getDescriptor().getMessageType(30); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor, + new java.lang.String[] { "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor = + getDescriptor().getMessageType(31); + internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor, + new java.lang.String[] { "AuthorizationUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_ImplicitOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_PasswordOAuthFlow_descriptor = + getDescriptor().getMessageType(32); + internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PasswordOAuthFlow_descriptor, + new java.lang.String[] { "TokenUrl", "RefreshUrl", "Scopes", }); + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor = + internal_static_a2a_v1_PasswordOAuthFlow_descriptor.getNestedType(0); + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_a2a_v1_SendMessageRequest_descriptor = + getDescriptor().getMessageType(33); + internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageRequest_descriptor, + new java.lang.String[] { "Request", "Configuration", "Metadata", }); + internal_static_a2a_v1_GetTaskRequest_descriptor = + getDescriptor().getMessageType(34); + internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetTaskRequest_descriptor, + new java.lang.String[] { "Name", "HistoryLength", }); + internal_static_a2a_v1_CancelTaskRequest_descriptor = + getDescriptor().getMessageType(35); + internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_CancelTaskRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(36); + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(37); + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(38); + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Parent", "ConfigId", "Config", }); + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor = + getDescriptor().getMessageType(39); + internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_TaskSubscriptionRequest_descriptor, + new java.lang.String[] { "Name", }); + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor = + getDescriptor().getMessageType(40); + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor, + new java.lang.String[] { "Parent", "PageSize", "PageToken", }); + internal_static_a2a_v1_GetAgentCardRequest_descriptor = + getDescriptor().getMessageType(41); + internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_GetAgentCardRequest_descriptor, + new java.lang.String[] { }); + internal_static_a2a_v1_SendMessageResponse_descriptor = + getDescriptor().getMessageType(42); + internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_SendMessageResponse_descriptor, + new java.lang.String[] { "Task", "Msg", "Payload", }); + internal_static_a2a_v1_StreamResponse_descriptor = + getDescriptor().getMessageType(43); + internal_static_a2a_v1_StreamResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_StreamResponse_descriptor, + new java.lang.String[] { "Task", "Msg", "StatusUpdate", "ArtifactUpdate", "Payload", }); + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor = + getDescriptor().getMessageType(44); + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor, + new java.lang.String[] { "Configs", "NextPageToken", }); + descriptor.resolveAllFeaturesImmutable(); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + com.google.protobuf.Descriptors.FileDescriptor + .internalUpdateFileDescriptor(descriptor, registry); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java new file mode 100644 index 000000000..73b1a3171 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/A2AServiceGrpc.java @@ -0,0 +1,1323 @@ +package org.a2aproject.sdk.compat03.grpc; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + *
+ * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+ * different shape than the JSONRPC version to better conform to AIP-127,
+ * where appropriate. The nouns are AgentCard, Message, Task and
+ * TaskPushNotificationConfig.
+ * - Messages are not a standard resource so there is no get/delete/update/list
+ *   interface, only a send and stream custom methods.
+ * - Tasks have a get interface and custom cancel and subscribe methods.
+ * - TaskPushNotificationConfig are a resource whose parent is a task.
+ *   They have get, list and create methods.
+ * - AgentCard is a static resource with only a get method.
+ * fields are not present as they don't comply with AIP rules, and the
+ * optional history_length on the get task method is not present as it also
+ * violates AIP-127 and AIP-131.
+ * 
+ */ +@io.grpc.stub.annotations.GrpcGenerated +public final class A2AServiceGrpc { + + private A2AServiceGrpc() {} + + public static final java.lang.String SERVICE_NAME = "a2a.v1.A2AService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getSendMessageMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SendMessage", + requestType = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getSendMessageMethod() { + io.grpc.MethodDescriptor getSendMessageMethod; + if ((getSendMessageMethod = A2AServiceGrpc.getSendMessageMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getSendMessageMethod = A2AServiceGrpc.getSendMessageMethod) == null) { + A2AServiceGrpc.getSendMessageMethod = getSendMessageMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendMessage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("SendMessage")) + .build(); + } + } + } + return getSendMessageMethod; + } + + private static volatile io.grpc.MethodDescriptor getSendStreamingMessageMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SendStreamingMessage", + requestType = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.StreamResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getSendStreamingMessageMethod() { + io.grpc.MethodDescriptor getSendStreamingMessageMethod; + if ((getSendStreamingMessageMethod = A2AServiceGrpc.getSendStreamingMessageMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getSendStreamingMessageMethod = A2AServiceGrpc.getSendStreamingMessageMethod) == null) { + A2AServiceGrpc.getSendStreamingMessageMethod = getSendStreamingMessageMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendStreamingMessage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("SendStreamingMessage")) + .build(); + } + } + } + return getSendStreamingMessageMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTask", + requestType = org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.Task.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTaskMethod() { + io.grpc.MethodDescriptor getGetTaskMethod; + if ((getGetTaskMethod = A2AServiceGrpc.getGetTaskMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetTaskMethod = A2AServiceGrpc.getGetTaskMethod) == null) { + A2AServiceGrpc.getGetTaskMethod = getGetTaskMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetTask")) + .build(); + } + } + } + return getGetTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor getCancelTaskMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CancelTask", + requestType = org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.Task.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCancelTaskMethod() { + io.grpc.MethodDescriptor getCancelTaskMethod; + if ((getCancelTaskMethod = A2AServiceGrpc.getCancelTaskMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getCancelTaskMethod = A2AServiceGrpc.getCancelTaskMethod) == null) { + A2AServiceGrpc.getCancelTaskMethod = getCancelTaskMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CancelTask")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("CancelTask")) + .build(); + } + } + } + return getCancelTaskMethod; + } + + private static volatile io.grpc.MethodDescriptor getTaskSubscriptionMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TaskSubscription", + requestType = org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.StreamResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + public static io.grpc.MethodDescriptor getTaskSubscriptionMethod() { + io.grpc.MethodDescriptor getTaskSubscriptionMethod; + if ((getTaskSubscriptionMethod = A2AServiceGrpc.getTaskSubscriptionMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getTaskSubscriptionMethod = A2AServiceGrpc.getTaskSubscriptionMethod) == null) { + A2AServiceGrpc.getTaskSubscriptionMethod = getTaskSubscriptionMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TaskSubscription")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("TaskSubscription")) + .build(); + } + } + } + return getTaskSubscriptionMethod; + } + + private static volatile io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getCreateTaskPushNotificationConfigMethod; + if ((getCreateTaskPushNotificationConfigMethod = A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getCreateTaskPushNotificationConfigMethod = A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getCreateTaskPushNotificationConfigMethod = getCreateTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("CreateTaskPushNotificationConfig")) + .build(); + } + } + } + return getCreateTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getGetTaskPushNotificationConfigMethod; + if ((getGetTaskPushNotificationConfigMethod = A2AServiceGrpc.getGetTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetTaskPushNotificationConfigMethod = A2AServiceGrpc.getGetTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getGetTaskPushNotificationConfigMethod = getGetTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetTaskPushNotificationConfig")) + .build(); + } + } + } + return getGetTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getListTaskPushNotificationConfigMethod; + if ((getListTaskPushNotificationConfigMethod = A2AServiceGrpc.getListTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getListTaskPushNotificationConfigMethod = A2AServiceGrpc.getListTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getListTaskPushNotificationConfigMethod = getListTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("ListTaskPushNotificationConfig")) + .build(); + } + } + } + return getListTaskPushNotificationConfigMethod; + } + + private static volatile io.grpc.MethodDescriptor getGetAgentCardMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetAgentCard", + requestType = org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, + responseType = org.a2aproject.sdk.compat03.grpc.AgentCard.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetAgentCardMethod() { + io.grpc.MethodDescriptor getGetAgentCardMethod; + if ((getGetAgentCardMethod = A2AServiceGrpc.getGetAgentCardMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getGetAgentCardMethod = A2AServiceGrpc.getGetAgentCardMethod) == null) { + A2AServiceGrpc.getGetAgentCardMethod = getGetAgentCardMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetAgentCard")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("GetAgentCard")) + .build(); + } + } + } + return getGetAgentCardMethod; + } + + private static volatile io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteTaskPushNotificationConfig", + requestType = org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod() { + io.grpc.MethodDescriptor getDeleteTaskPushNotificationConfigMethod; + if ((getDeleteTaskPushNotificationConfigMethod = A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod) == null) { + synchronized (A2AServiceGrpc.class) { + if ((getDeleteTaskPushNotificationConfigMethod = A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod) == null) { + A2AServiceGrpc.getDeleteTaskPushNotificationConfigMethod = getDeleteTaskPushNotificationConfigMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteTaskPushNotificationConfig")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor(new A2AServiceMethodDescriptorSupplier("DeleteTaskPushNotificationConfig")) + .build(); + } + } + } + return getDeleteTaskPushNotificationConfigMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static A2AServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceStub(channel, callOptions); + } + }; + return A2AServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports all types of calls on the service + */ + public static A2AServiceBlockingV2Stub newBlockingV2Stub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceBlockingV2Stub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingV2Stub(channel, callOptions); + } + }; + return A2AServiceBlockingV2Stub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static A2AServiceBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingStub(channel, callOptions); + } + }; + return A2AServiceBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static A2AServiceFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public A2AServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceFutureStub(channel, callOptions); + } + }; + return A2AServiceFutureStub.newStub(factory, channel); + } + + /** + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public interface AsyncService { + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + default void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSendMessageMethod(), responseObserver); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + default void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSendStreamingMessageMethod(), responseObserver); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + default void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskMethod(), responseObserver); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + default void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCancelTaskMethod(), responseObserver); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + default void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getTaskSubscriptionMethod(), responseObserver); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + default void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCreateTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + default void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + default void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTaskPushNotificationConfigMethod(), responseObserver); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + default void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAgentCardMethod(), responseObserver); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + default void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDeleteTaskPushNotificationConfigMethod(), responseObserver); + } + } + + /** + * Base class for the server implementation of the service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static abstract class A2AServiceImplBase + implements io.grpc.BindableService, AsyncService { + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return A2AServiceGrpc.bindService(this); + } + } + + /** + * A stub to allow clients to do asynchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private A2AServiceStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSendMessageMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + public void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getSendStreamingMessageMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + public void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncServerStreamingCall( + getChannel().newCall(getTaskSubscriptionMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetAgentCardMethod(), getCallOptions()), request, responseObserver); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteTaskPushNotificationConfigMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * A stub to allow clients to do synchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceBlockingV2Stub + extends io.grpc.stub.AbstractBlockingStub { + private A2AServiceBlockingV2Stub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceBlockingV2Stub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingV2Stub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getSendMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall + sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall( + getChannel(), getSendStreamingMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCancelTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/10918") + public io.grpc.stub.BlockingClientCall + taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request) { + return io.grpc.stub.ClientCalls.blockingV2ServerStreamingCall( + getChannel(), getTaskSubscriptionMethod(), getCallOptions(), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getCreateTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getListTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.AgentCard getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getGetAgentCardMethod(), getCallOptions(), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.protobuf.Empty deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) throws io.grpc.StatusException { + return io.grpc.stub.ClientCalls.blockingV2UnaryCall( + getChannel(), getDeleteTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do limited synchronous rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private A2AServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceBlockingStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSendMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * SendStreamingMessage is a streaming call that will return a stream of
+     * task update events until the Task is in an interrupted or terminal state.
+     * 
+ */ + public java.util.Iterator sendStreamingMessage( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getSendStreamingMessageMethod(), getCallOptions(), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.Task cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCancelTaskMethod(), getCallOptions(), request); + } + + /** + *
+     * TaskSubscription is a streaming call that will return a stream of task
+     * update events. This attaches the stream to an existing in process task.
+     * If the task is complete the stream will return the completed task (like
+     * GetTask) and close the stream.
+     * 
+ */ + public java.util.Iterator taskSubscription( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request) { + return io.grpc.stub.ClientCalls.blockingServerStreamingCall( + getChannel(), getTaskSubscriptionMethod(), getCallOptions(), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public org.a2aproject.sdk.compat03.grpc.AgentCard getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetAgentCardMethod(), getCallOptions(), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.protobuf.Empty deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteTaskPushNotificationConfigMethod(), getCallOptions(), request); + } + } + + /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service A2AService. + *
+   * A2AService defines the gRPC version of the A2A protocol. This has a slightly
+   * different shape than the JSONRPC version to better conform to AIP-127,
+   * where appropriate. The nouns are AgentCard, Message, Task and
+   * TaskPushNotificationConfig.
+   * - Messages are not a standard resource so there is no get/delete/update/list
+   *   interface, only a send and stream custom methods.
+   * - Tasks have a get interface and custom cancel and subscribe methods.
+   * - TaskPushNotificationConfig are a resource whose parent is a task.
+   *   They have get, list and create methods.
+   * - AgentCard is a static resource with only a get method.
+   * fields are not present as they don't comply with AIP rules, and the
+   * optional history_length on the get task method is not present as it also
+   * violates AIP-127 and AIP-131.
+   * 
+ */ + public static final class A2AServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private A2AServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected A2AServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new A2AServiceFutureStub(channel, callOptions); + } + + /** + *
+     * Send a message to the agent. This is a blocking call that will return the
+     * task once it is completed, or a LRO if requested.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture sendMessage( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSendMessageMethod(), getCallOptions()), request); + } + + /** + *
+     * Get the current state of a task from the agent.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTask( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskMethod(), getCallOptions()), request); + } + + /** + *
+     * Cancel a task from the agent. If supported one should expect no
+     * more task updates for the task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture cancelTask( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCancelTaskMethod(), getCallOptions()), request); + } + + /** + *
+     * Set a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture createTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * Get a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * Get a list of push notifications configured for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture listTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + + /** + *
+     * GetAgentCard returns the agent card for the agent.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getAgentCard( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetAgentCardMethod(), getCallOptions()), request); + } + + /** + *
+     * Delete a push notification config for a task.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture deleteTaskPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteTaskPushNotificationConfigMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_SEND_MESSAGE = 0; + private static final int METHODID_SEND_STREAMING_MESSAGE = 1; + private static final int METHODID_GET_TASK = 2; + private static final int METHODID_CANCEL_TASK = 3; + private static final int METHODID_TASK_SUBSCRIPTION = 4; + private static final int METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG = 5; + private static final int METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG = 6; + private static final int METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG = 7; + private static final int METHODID_GET_AGENT_CARD = 8; + private static final int METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG = 9; + + private static final class MethodHandlers implements + io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final AsyncService serviceImpl; + private final int methodId; + + MethodHandlers(AsyncService serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_SEND_MESSAGE: + serviceImpl.sendMessage((org.a2aproject.sdk.compat03.grpc.SendMessageRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SEND_STREAMING_MESSAGE: + serviceImpl.sendStreamingMessage((org.a2aproject.sdk.compat03.grpc.SendMessageRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TASK: + serviceImpl.getTask((org.a2aproject.sdk.compat03.grpc.GetTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CANCEL_TASK: + serviceImpl.cancelTask((org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TASK_SUBSCRIPTION: + serviceImpl.taskSubscription((org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.createTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.getTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.listTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_AGENT_CARD: + serviceImpl.getAgentCard((org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG: + serviceImpl.deleteTaskPushNotificationConfig((org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getSendMessageMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.SendMessageRequest, + org.a2aproject.sdk.compat03.grpc.SendMessageResponse>( + service, METHODID_SEND_MESSAGE))) + .addMethod( + getSendStreamingMessageMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.SendMessageRequest, + org.a2aproject.sdk.compat03.grpc.StreamResponse>( + service, METHODID_SEND_STREAMING_MESSAGE))) + .addMethod( + getGetTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetTaskRequest, + org.a2aproject.sdk.compat03.grpc.Task>( + service, METHODID_GET_TASK))) + .addMethod( + getCancelTaskMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest, + org.a2aproject.sdk.compat03.grpc.Task>( + service, METHODID_CANCEL_TASK))) + .addMethod( + getTaskSubscriptionMethod(), + io.grpc.stub.ServerCalls.asyncServerStreamingCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest, + org.a2aproject.sdk.compat03.grpc.StreamResponse>( + service, METHODID_TASK_SUBSCRIPTION))) + .addMethod( + getCreateTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig>( + service, METHODID_CREATE_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getGetTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig>( + service, METHODID_GET_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getListTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest, + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse>( + service, METHODID_LIST_TASK_PUSH_NOTIFICATION_CONFIG))) + .addMethod( + getGetAgentCardMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest, + org.a2aproject.sdk.compat03.grpc.AgentCard>( + service, METHODID_GET_AGENT_CARD))) + .addMethod( + getDeleteTaskPushNotificationConfigMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest, + com.google.protobuf.Empty>( + service, METHODID_DELETE_TASK_PUSH_NOTIFICATION_CONFIG))) + .build(); + } + + private static abstract class A2AServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + A2AServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("A2AService"); + } + } + + private static final class A2AServiceFileDescriptorSupplier + extends A2AServiceBaseDescriptorSupplier { + A2AServiceFileDescriptorSupplier() {} + } + + private static final class A2AServiceMethodDescriptorSupplier + extends A2AServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final java.lang.String methodName; + + A2AServiceMethodDescriptorSupplier(java.lang.String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (A2AServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new A2AServiceFileDescriptorSupplier()) + .addMethod(getSendMessageMethod()) + .addMethod(getSendStreamingMessageMethod()) + .addMethod(getGetTaskMethod()) + .addMethod(getCancelTaskMethod()) + .addMethod(getTaskSubscriptionMethod()) + .addMethod(getCreateTaskPushNotificationConfigMethod()) + .addMethod(getGetTaskPushNotificationConfigMethod()) + .addMethod(getListTaskPushNotificationConfigMethod()) + .addMethod(getGetAgentCardMethod()) + .addMethod(getDeleteTaskPushNotificationConfigMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java new file mode 100644 index 000000000..d690ad8cf --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecurityScheme.java @@ -0,0 +1,858 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.APIKeySecurityScheme} + */ +@com.google.protobuf.Generated +public final class APIKeySecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.APIKeySecurityScheme) + APIKeySecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "APIKeySecurityScheme"); + } + // Use APIKeySecurityScheme.newBuilder() to construct. + private APIKeySecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private APIKeySecurityScheme() { + description_ = ""; + location_ = ""; + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.class, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOCATION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object location_ = ""; + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The location. + */ + @java.lang.Override + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } + } + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The bytes for location. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(location_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, location_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(location_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, location_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme other = (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getLocation() + .equals(other.getLocation())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + LOCATION_FIELD_NUMBER; + hash = (53 * hash) + getLocation().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.APIKeySecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.APIKeySecurityScheme) + org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_APIKeySecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.class, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + location_ = ""; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_APIKeySecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result = new org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.location_ = location_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getLocation().isEmpty()) { + location_ = other.location_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + location_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object location_ = ""; + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return The location. + */ + public java.lang.String getLocation() { + java.lang.Object ref = location_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + location_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return The bytes for location. + */ + public com.google.protobuf.ByteString + getLocationBytes() { + java.lang.Object ref = location_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + location_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @param value The location to set. + * @return This builder for chaining. + */ + public Builder setLocation( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + location_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @return This builder for chaining. + */ + public Builder clearLocation() { + location_ = getDefaultInstance().getLocation(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Location of the API key, valid values are "query", "header", or "cookie"
+     * 
+ * + * string location = 2; + * @param value The bytes for location to set. + * @return This builder for chaining. + */ + public Builder setLocationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + location_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * Name of the header, query or cookie parameter to be used.
+     * 
+ * + * string name = 3; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.APIKeySecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.APIKeySecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public APIKeySecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java new file mode 100644 index 000000000..7c5b8258e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/APIKeySecuritySchemeOrBuilder.java @@ -0,0 +1,72 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface APIKeySecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.APIKeySecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The location. + */ + java.lang.String getLocation(); + /** + *
+   * Location of the API key, valid values are "query", "header", or "cookie"
+   * 
+ * + * string location = 2; + * @return The bytes for location. + */ + com.google.protobuf.ByteString + getLocationBytes(); + + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * Name of the header, query or cookie parameter to be used.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java new file mode 100644 index 000000000..a7007be29 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilities.java @@ -0,0 +1,986 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines the A2A feature set supported by the agent
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCapabilities} + */ +@com.google.protobuf.Generated +public final class AgentCapabilities extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCapabilities) + AgentCapabilitiesOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCapabilities"); + } + // Use AgentCapabilities.newBuilder() to construct. + private AgentCapabilities(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCapabilities() { + extensions_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.class, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder.class); + } + + public static final int STREAMING_FIELD_NUMBER = 1; + private boolean streaming_ = false; + /** + *
+   * If the agent will support streaming responses
+   * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + @java.lang.Override + public boolean getStreaming() { + return streaming_; + } + + public static final int PUSH_NOTIFICATIONS_FIELD_NUMBER = 2; + private boolean pushNotifications_ = false; + /** + *
+   * If the agent can send push notifications to the clients webhook
+   * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + @java.lang.Override + public boolean getPushNotifications() { + return pushNotifications_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private java.util.List extensions_; + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public java.util.List getExtensionsList() { + return extensions_; + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public java.util.List + getExtensionsOrBuilderList() { + return extensions_; + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index) { + return extensions_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (streaming_ != false) { + output.writeBool(1, streaming_); + } + if (pushNotifications_ != false) { + output.writeBool(2, pushNotifications_); + } + for (int i = 0; i < extensions_.size(); i++) { + output.writeMessage(3, extensions_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (streaming_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, streaming_); + } + if (pushNotifications_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(2, pushNotifications_); + } + for (int i = 0; i < extensions_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, extensions_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCapabilities)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCapabilities other = (org.a2aproject.sdk.compat03.grpc.AgentCapabilities) obj; + + if (getStreaming() + != other.getStreaming()) return false; + if (getPushNotifications() + != other.getPushNotifications()) return false; + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STREAMING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getStreaming()); + hash = (37 * hash) + PUSH_NOTIFICATIONS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getPushNotifications()); + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCapabilities prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines the A2A feature set supported by the agent
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCapabilities} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCapabilities) + org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCapabilities_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.class, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCapabilities.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + streaming_ = false; + pushNotifications_ = false; + if (extensionsBuilder_ == null) { + extensions_ = java.util.Collections.emptyList(); + } else { + extensions_ = null; + extensionsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCapabilities_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities build() { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities result = new org.a2aproject.sdk.compat03.grpc.AgentCapabilities(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentCapabilities result) { + if (extensionsBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0)) { + extensions_ = java.util.Collections.unmodifiableList(extensions_); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.extensions_ = extensions_; + } else { + result.extensions_ = extensionsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCapabilities result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.streaming_ = streaming_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotifications_ = pushNotifications_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCapabilities) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCapabilities)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCapabilities other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance()) return this; + if (other.getStreaming() != false) { + setStreaming(other.getStreaming()); + } + if (other.getPushNotifications() != false) { + setPushNotifications(other.getPushNotifications()); + } + if (extensionsBuilder_ == null) { + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + } else { + if (!other.extensions_.isEmpty()) { + if (extensionsBuilder_.isEmpty()) { + extensionsBuilder_.dispose(); + extensionsBuilder_ = null; + extensions_ = other.extensions_; + bitField0_ = (bitField0_ & ~0x00000004); + extensionsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetExtensionsFieldBuilder() : null; + } else { + extensionsBuilder_.addAllMessages(other.extensions_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + streaming_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 16: { + pushNotifications_ = input.readBool(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: { + org.a2aproject.sdk.compat03.grpc.AgentExtension m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentExtension.parser(), + extensionRegistry); + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(m); + } else { + extensionsBuilder_.addMessage(m); + } + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private boolean streaming_ ; + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + @java.lang.Override + public boolean getStreaming() { + return streaming_; + } + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @param value The streaming to set. + * @return This builder for chaining. + */ + public Builder setStreaming(boolean value) { + + streaming_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * If the agent will support streaming responses
+     * 
+ * + * bool streaming = 1; + * @return This builder for chaining. + */ + public Builder clearStreaming() { + bitField0_ = (bitField0_ & ~0x00000001); + streaming_ = false; + onChanged(); + return this; + } + + private boolean pushNotifications_ ; + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + @java.lang.Override + public boolean getPushNotifications() { + return pushNotifications_; + } + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @param value The pushNotifications to set. + * @return This builder for chaining. + */ + public Builder setPushNotifications(boolean value) { + + pushNotifications_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * If the agent can send push notifications to the clients webhook
+     * 
+ * + * bool push_notifications = 2; + * @return This builder for chaining. + */ + public Builder clearPushNotifications() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotifications_ = false; + onChanged(); + return this; + } + + private java.util.List extensions_ = + java.util.Collections.emptyList(); + private void ensureExtensionsIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + extensions_ = new java.util.ArrayList(extensions_); + bitField0_ |= 0x00000004; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder> extensionsBuilder_; + + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List getExtensionsList() { + if (extensionsBuilder_ == null) { + return java.util.Collections.unmodifiableList(extensions_); + } else { + return extensionsBuilder_.getMessageList(); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public int getExtensionsCount() { + if (extensionsBuilder_ == null) { + return extensions_.size(); + } else { + return extensionsBuilder_.getCount(); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index) { + if (extensionsBuilder_ == null) { + return extensions_.get(index); + } else { + return extensionsBuilder_.getMessage(index); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder setExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + onChanged(); + } else { + extensionsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder setExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.set(index, builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions(org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.add(value); + onChanged(); + } else { + extensionsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension value) { + if (extensionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureExtensionsIsMutable(); + extensions_.add(index, value); + onChanged(); + } else { + extensionsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addExtensions( + int index, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builderForValue) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.add(index, builderForValue.build()); + onChanged(); + } else { + extensionsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + onChanged(); + } else { + extensionsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder clearExtensions() { + if (extensionsBuilder_ == null) { + extensions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + } else { + extensionsBuilder_.clear(); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public Builder removeExtensions(int index) { + if (extensionsBuilder_ == null) { + ensureExtensionsIsMutable(); + extensions_.remove(index); + onChanged(); + } else { + extensionsBuilder_.remove(index); + } + return this; + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder getExtensionsBuilder( + int index) { + return internalGetExtensionsFieldBuilder().getBuilder(index); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index) { + if (extensionsBuilder_ == null) { + return extensions_.get(index); } else { + return extensionsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List + getExtensionsOrBuilderList() { + if (extensionsBuilder_ != null) { + return extensionsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(extensions_); + } + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder addExtensionsBuilder() { + return internalGetExtensionsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder addExtensionsBuilder( + int index) { + return internalGetExtensionsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()); + } + /** + *
+     * Extensions supported by this agent.
+     * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + public java.util.List + getExtensionsBuilderList() { + return internalGetExtensionsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder> + internalGetExtensionsFieldBuilder() { + if (extensionsBuilder_ == null) { + extensionsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentExtension, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder, org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder>( + extensions_, + ((bitField0_ & 0x00000004) != 0), + getParentForChildren(), + isClean()); + extensions_ = null; + } + return extensionsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCapabilities) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCapabilities) + private static final org.a2aproject.sdk.compat03.grpc.AgentCapabilities DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCapabilities(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCapabilities parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java new file mode 100644 index 000000000..47b710f89 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCapabilitiesOrBuilder.java @@ -0,0 +1,76 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCapabilitiesOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCapabilities) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * If the agent will support streaming responses
+   * 
+ * + * bool streaming = 1; + * @return The streaming. + */ + boolean getStreaming(); + + /** + *
+   * If the agent can send push notifications to the clients webhook
+   * 
+ * + * bool push_notifications = 2; + * @return The pushNotifications. + */ + boolean getPushNotifications(); + + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + java.util.List + getExtensionsList(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + org.a2aproject.sdk.compat03.grpc.AgentExtension getExtensions(int index); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + int getExtensionsCount(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + java.util.List + getExtensionsOrBuilderList(); + /** + *
+   * Extensions supported by this agent.
+   * 
+ * + * repeated .a2a.v1.AgentExtension extensions = 3; + */ + org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder getExtensionsOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java new file mode 100644 index 000000000..da2f8a5f2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCard.java @@ -0,0 +1,5131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentCard conveys key information:
+ * - Overall details (version, name, description, uses)
+ * - Skills; a set of actions/solutions the agent can perform
+ * - Default modalities/content types supported by the agent.
+ * - Authentication requirements
+ * Next ID: 18
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCard} + */ +@com.google.protobuf.Generated +public final class AgentCard extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCard) + AgentCardOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCard"); + } + // Use AgentCard.newBuilder() to construct. + private AgentCard(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCard() { + protocolVersion_ = ""; + name_ = ""; + description_ = ""; + url_ = ""; + preferredTransport_ = ""; + additionalInterfaces_ = java.util.Collections.emptyList(); + version_ = ""; + documentationUrl_ = ""; + security_ = java.util.Collections.emptyList(); + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + skills_ = java.util.Collections.emptyList(); + signatures_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCard.class, org.a2aproject.sdk.compat03.grpc.AgentCard.Builder.class); + } + + private int bitField0_; + public static final int PROTOCOL_VERSION_FIELD_NUMBER = 16; + @SuppressWarnings("serial") + private volatile java.lang.Object protocolVersion_ = ""; + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + @java.lang.Override + public java.lang.String getProtocolVersion() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protocolVersion_ = s; + return s; + } + } + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getProtocolVersionBytes() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protocolVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PREFERRED_TRANSPORT_FIELD_NUMBER = 14; + @SuppressWarnings("serial") + private volatile java.lang.Object preferredTransport_ = ""; + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + @java.lang.Override + public java.lang.String getPreferredTransport() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + preferredTransport_ = s; + return s; + } + } + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getPreferredTransportBytes() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + preferredTransport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ADDITIONAL_INTERFACES_FIELD_NUMBER = 15; + @SuppressWarnings("serial") + private java.util.List additionalInterfaces_; + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public java.util.List getAdditionalInterfacesList() { + return additionalInterfaces_; + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public java.util.List + getAdditionalInterfacesOrBuilderList() { + return additionalInterfaces_; + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public int getAdditionalInterfacesCount() { + return additionalInterfaces_.size(); + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index) { + return additionalInterfaces_.get(index); + } + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index) { + return additionalInterfaces_.get(index); + } + + public static final int PROVIDER_FIELD_NUMBER = 4; + private org.a2aproject.sdk.compat03.grpc.AgentProvider provider_; + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + @java.lang.Override + public boolean hasProvider() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider() { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder() { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + + public static final int VERSION_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private volatile java.lang.Object version_ = ""; + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The version. + */ + @java.lang.Override + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } + } + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The bytes for version. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DOCUMENTATION_URL_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private volatile java.lang.Object documentationUrl_ = ""; + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + @java.lang.Override + public java.lang.String getDocumentationUrl() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + documentationUrl_ = s; + return s; + } + } + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDocumentationUrlBytes() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + documentationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CAPABILITIES_FIELD_NUMBER = 7; + private org.a2aproject.sdk.compat03.grpc.AgentCapabilities capabilities_; + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + @java.lang.Override + public boolean hasCapabilities() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities() { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder() { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + + public static final int SECURITY_SCHEMES_FIELD_NUMBER = 8; + private static final class SecuritySchemesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecurityScheme> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_SecuritySchemesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance()); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecurityScheme> securitySchemes_; + private com.google.protobuf.MapField + internalGetSecuritySchemes() { + if (securitySchemes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + SecuritySchemesDefaultEntryHolder.defaultEntry); + } + return securitySchemes_; + } + public int getSecuritySchemesCount() { + return internalGetSecuritySchemes().getMap().size(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public boolean containsSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSecuritySchemes().getMap().containsKey(key); + } + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSecuritySchemes() { + return getSecuritySchemesMap(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public java.util.Map getSecuritySchemesMap() { + return internalGetSecuritySchemes().getMap(); + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSecuritySchemes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSecuritySchemes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int SECURITY_FIELD_NUMBER = 9; + @SuppressWarnings("serial") + private java.util.List security_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public java.util.List getSecurityList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public java.util.List + getSecurityOrBuilderList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public int getSecurityCount() { + return security_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + return security_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + return security_.get(index); + } + + public static final int DEFAULT_INPUT_MODES_FIELD_NUMBER = 10; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultInputModesList() { + return defaultInputModes_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + public int getDefaultInputModesCount() { + return defaultInputModes_.size(); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + public java.lang.String getDefaultInputModes(int index) { + return defaultInputModes_.get(index); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultInputModesBytes(int index) { + return defaultInputModes_.getByteString(index); + } + + public static final int DEFAULT_OUTPUT_MODES_FIELD_NUMBER = 11; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultOutputModesList() { + return defaultOutputModes_; + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + public int getDefaultOutputModesCount() { + return defaultOutputModes_.size(); + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + public java.lang.String getDefaultOutputModes(int index) { + return defaultOutputModes_.get(index); + } + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index) { + return defaultOutputModes_.getByteString(index); + } + + public static final int SKILLS_FIELD_NUMBER = 12; + @SuppressWarnings("serial") + private java.util.List skills_; + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public java.util.List getSkillsList() { + return skills_; + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public java.util.List + getSkillsOrBuilderList() { + return skills_; + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public int getSkillsCount() { + return skills_.size(); + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index) { + return skills_.get(index); + } + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index) { + return skills_.get(index); + } + + public static final int SUPPORTS_AUTHENTICATED_EXTENDED_CARD_FIELD_NUMBER = 13; + private boolean supportsAuthenticatedExtendedCard_ = false; + /** + *
+   * Whether the agent supports providing an extended agent card when
+   * the user is authenticated, i.e. is the card from .well-known
+   * different than the card from GetAgentCard.
+   * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + @java.lang.Override + public boolean getSupportsAuthenticatedExtendedCard() { + return supportsAuthenticatedExtendedCard_; + } + + public static final int SIGNATURES_FIELD_NUMBER = 17; + @SuppressWarnings("serial") + private java.util.List signatures_; + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public java.util.List getSignaturesList() { + return signatures_; + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public java.util.List + getSignaturesOrBuilderList() { + return signatures_; + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public int getSignaturesCount() { + return signatures_.size(); + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index) { + return signatures_.get(index); + } + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index) { + return signatures_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, url_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getProvider()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(version_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, version_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(documentationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, documentationUrl_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(7, getCapabilities()); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetSecuritySchemes(), + SecuritySchemesDefaultEntryHolder.defaultEntry, + 8); + for (int i = 0; i < security_.size(); i++) { + output.writeMessage(9, security_.get(i)); + } + for (int i = 0; i < defaultInputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 10, defaultInputModes_.getRaw(i)); + } + for (int i = 0; i < defaultOutputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 11, defaultOutputModes_.getRaw(i)); + } + for (int i = 0; i < skills_.size(); i++) { + output.writeMessage(12, skills_.get(i)); + } + if (supportsAuthenticatedExtendedCard_ != false) { + output.writeBool(13, supportsAuthenticatedExtendedCard_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(preferredTransport_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 14, preferredTransport_); + } + for (int i = 0; i < additionalInterfaces_.size(); i++) { + output.writeMessage(15, additionalInterfaces_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protocolVersion_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 16, protocolVersion_); + } + for (int i = 0; i < signatures_.size(); i++) { + output.writeMessage(17, signatures_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, url_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getProvider()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(version_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(5, version_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(documentationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(6, documentationUrl_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getCapabilities()); + } + for (java.util.Map.Entry entry + : internalGetSecuritySchemes().getMap().entrySet()) { + com.google.protobuf.MapEntry + securitySchemes__ = SecuritySchemesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, securitySchemes__); + } + for (int i = 0; i < security_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, security_.get(i)); + } + { + int dataSize = 0; + for (int i = 0; i < defaultInputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(defaultInputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getDefaultInputModesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < defaultOutputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(defaultOutputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getDefaultOutputModesList().size(); + } + for (int i = 0; i < skills_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(12, skills_.get(i)); + } + if (supportsAuthenticatedExtendedCard_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(13, supportsAuthenticatedExtendedCard_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(preferredTransport_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(14, preferredTransport_); + } + for (int i = 0; i < additionalInterfaces_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(15, additionalInterfaces_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protocolVersion_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(16, protocolVersion_); + } + for (int i = 0; i < signatures_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(17, signatures_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCard)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCard other = (org.a2aproject.sdk.compat03.grpc.AgentCard) obj; + + if (!getProtocolVersion() + .equals(other.getProtocolVersion())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getPreferredTransport() + .equals(other.getPreferredTransport())) return false; + if (!getAdditionalInterfacesList() + .equals(other.getAdditionalInterfacesList())) return false; + if (hasProvider() != other.hasProvider()) return false; + if (hasProvider()) { + if (!getProvider() + .equals(other.getProvider())) return false; + } + if (!getVersion() + .equals(other.getVersion())) return false; + if (!getDocumentationUrl() + .equals(other.getDocumentationUrl())) return false; + if (hasCapabilities() != other.hasCapabilities()) return false; + if (hasCapabilities()) { + if (!getCapabilities() + .equals(other.getCapabilities())) return false; + } + if (!internalGetSecuritySchemes().equals( + other.internalGetSecuritySchemes())) return false; + if (!getSecurityList() + .equals(other.getSecurityList())) return false; + if (!getDefaultInputModesList() + .equals(other.getDefaultInputModesList())) return false; + if (!getDefaultOutputModesList() + .equals(other.getDefaultOutputModesList())) return false; + if (!getSkillsList() + .equals(other.getSkillsList())) return false; + if (getSupportsAuthenticatedExtendedCard() + != other.getSupportsAuthenticatedExtendedCard()) return false; + if (!getSignaturesList() + .equals(other.getSignaturesList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROTOCOL_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getProtocolVersion().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + PREFERRED_TRANSPORT_FIELD_NUMBER; + hash = (53 * hash) + getPreferredTransport().hashCode(); + if (getAdditionalInterfacesCount() > 0) { + hash = (37 * hash) + ADDITIONAL_INTERFACES_FIELD_NUMBER; + hash = (53 * hash) + getAdditionalInterfacesList().hashCode(); + } + if (hasProvider()) { + hash = (37 * hash) + PROVIDER_FIELD_NUMBER; + hash = (53 * hash) + getProvider().hashCode(); + } + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion().hashCode(); + hash = (37 * hash) + DOCUMENTATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getDocumentationUrl().hashCode(); + if (hasCapabilities()) { + hash = (37 * hash) + CAPABILITIES_FIELD_NUMBER; + hash = (53 * hash) + getCapabilities().hashCode(); + } + if (!internalGetSecuritySchemes().getMap().isEmpty()) { + hash = (37 * hash) + SECURITY_SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + internalGetSecuritySchemes().hashCode(); + } + if (getSecurityCount() > 0) { + hash = (37 * hash) + SECURITY_FIELD_NUMBER; + hash = (53 * hash) + getSecurityList().hashCode(); + } + if (getDefaultInputModesCount() > 0) { + hash = (37 * hash) + DEFAULT_INPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getDefaultInputModesList().hashCode(); + } + if (getDefaultOutputModesCount() > 0) { + hash = (37 * hash) + DEFAULT_OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getDefaultOutputModesList().hashCode(); + } + if (getSkillsCount() > 0) { + hash = (37 * hash) + SKILLS_FIELD_NUMBER; + hash = (53 * hash) + getSkillsList().hashCode(); + } + hash = (37 * hash) + SUPPORTS_AUTHENTICATED_EXTENDED_CARD_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getSupportsAuthenticatedExtendedCard()); + if (getSignaturesCount() > 0) { + hash = (37 * hash) + SIGNATURES_FIELD_NUMBER; + hash = (53 * hash) + getSignaturesList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCard parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCard prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentCard conveys key information:
+   * - Overall details (version, name, description, uses)
+   * - Skills; a set of actions/solutions the agent can perform
+   * - Default modalities/content types supported by the agent.
+   * - Authentication requirements
+   * Next ID: 18
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCard} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCard) + org.a2aproject.sdk.compat03.grpc.AgentCardOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 8: + return internalGetMutableSecuritySchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCard.class, org.a2aproject.sdk.compat03.grpc.AgentCard.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCard.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetAdditionalInterfacesFieldBuilder(); + internalGetProviderFieldBuilder(); + internalGetCapabilitiesFieldBuilder(); + internalGetSecurityFieldBuilder(); + internalGetSkillsFieldBuilder(); + internalGetSignaturesFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + protocolVersion_ = ""; + name_ = ""; + description_ = ""; + url_ = ""; + preferredTransport_ = ""; + if (additionalInterfacesBuilder_ == null) { + additionalInterfaces_ = java.util.Collections.emptyList(); + } else { + additionalInterfaces_ = null; + additionalInterfacesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); + provider_ = null; + if (providerBuilder_ != null) { + providerBuilder_.dispose(); + providerBuilder_ = null; + } + version_ = ""; + documentationUrl_ = ""; + capabilities_ = null; + if (capabilitiesBuilder_ != null) { + capabilitiesBuilder_.dispose(); + capabilitiesBuilder_ = null; + } + internalGetMutableSecuritySchemes().clear(); + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + } else { + security_ = null; + securityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000800); + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + if (skillsBuilder_ == null) { + skills_ = java.util.Collections.emptyList(); + } else { + skills_ = null; + skillsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00004000); + supportsAuthenticatedExtendedCard_ = false; + if (signaturesBuilder_ == null) { + signatures_ = java.util.Collections.emptyList(); + } else { + signatures_ = null; + signaturesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00010000); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCard_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard build() { + org.a2aproject.sdk.compat03.grpc.AgentCard result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCard result = new org.a2aproject.sdk.compat03.grpc.AgentCard(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentCard result) { + if (additionalInterfacesBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0)) { + additionalInterfaces_ = java.util.Collections.unmodifiableList(additionalInterfaces_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.additionalInterfaces_ = additionalInterfaces_; + } else { + result.additionalInterfaces_ = additionalInterfacesBuilder_.build(); + } + if (securityBuilder_ == null) { + if (((bitField0_ & 0x00000800) != 0)) { + security_ = java.util.Collections.unmodifiableList(security_); + bitField0_ = (bitField0_ & ~0x00000800); + } + result.security_ = security_; + } else { + result.security_ = securityBuilder_.build(); + } + if (skillsBuilder_ == null) { + if (((bitField0_ & 0x00004000) != 0)) { + skills_ = java.util.Collections.unmodifiableList(skills_); + bitField0_ = (bitField0_ & ~0x00004000); + } + result.skills_ = skills_; + } else { + result.skills_ = skillsBuilder_.build(); + } + if (signaturesBuilder_ == null) { + if (((bitField0_ & 0x00010000) != 0)) { + signatures_ = java.util.Collections.unmodifiableList(signatures_); + bitField0_ = (bitField0_ & ~0x00010000); + } + result.signatures_ = signatures_; + } else { + result.signatures_ = signaturesBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCard result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.protocolVersion_ = protocolVersion_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.preferredTransport_ = preferredTransport_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000040) != 0)) { + result.provider_ = providerBuilder_ == null + ? provider_ + : providerBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.version_ = version_; + } + if (((from_bitField0_ & 0x00000100) != 0)) { + result.documentationUrl_ = documentationUrl_; + } + if (((from_bitField0_ & 0x00000200) != 0)) { + result.capabilities_ = capabilitiesBuilder_ == null + ? capabilities_ + : capabilitiesBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000400) != 0)) { + result.securitySchemes_ = internalGetSecuritySchemes().build(SecuritySchemesDefaultEntryHolder.defaultEntry); + } + if (((from_bitField0_ & 0x00001000) != 0)) { + defaultInputModes_.makeImmutable(); + result.defaultInputModes_ = defaultInputModes_; + } + if (((from_bitField0_ & 0x00002000) != 0)) { + defaultOutputModes_.makeImmutable(); + result.defaultOutputModes_ = defaultOutputModes_; + } + if (((from_bitField0_ & 0x00008000) != 0)) { + result.supportsAuthenticatedExtendedCard_ = supportsAuthenticatedExtendedCard_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCard) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCard)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCard other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCard.getDefaultInstance()) return this; + if (!other.getProtocolVersion().isEmpty()) { + protocolVersion_ = other.protocolVersion_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000008; + onChanged(); + } + if (!other.getPreferredTransport().isEmpty()) { + preferredTransport_ = other.preferredTransport_; + bitField0_ |= 0x00000010; + onChanged(); + } + if (additionalInterfacesBuilder_ == null) { + if (!other.additionalInterfaces_.isEmpty()) { + if (additionalInterfaces_.isEmpty()) { + additionalInterfaces_ = other.additionalInterfaces_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.addAll(other.additionalInterfaces_); + } + onChanged(); + } + } else { + if (!other.additionalInterfaces_.isEmpty()) { + if (additionalInterfacesBuilder_.isEmpty()) { + additionalInterfacesBuilder_.dispose(); + additionalInterfacesBuilder_ = null; + additionalInterfaces_ = other.additionalInterfaces_; + bitField0_ = (bitField0_ & ~0x00000020); + additionalInterfacesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetAdditionalInterfacesFieldBuilder() : null; + } else { + additionalInterfacesBuilder_.addAllMessages(other.additionalInterfaces_); + } + } + } + if (other.hasProvider()) { + mergeProvider(other.getProvider()); + } + if (!other.getVersion().isEmpty()) { + version_ = other.version_; + bitField0_ |= 0x00000080; + onChanged(); + } + if (!other.getDocumentationUrl().isEmpty()) { + documentationUrl_ = other.documentationUrl_; + bitField0_ |= 0x00000100; + onChanged(); + } + if (other.hasCapabilities()) { + mergeCapabilities(other.getCapabilities()); + } + internalGetMutableSecuritySchemes().mergeFrom( + other.internalGetSecuritySchemes()); + bitField0_ |= 0x00000400; + if (securityBuilder_ == null) { + if (!other.security_.isEmpty()) { + if (security_.isEmpty()) { + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000800); + } else { + ensureSecurityIsMutable(); + security_.addAll(other.security_); + } + onChanged(); + } + } else { + if (!other.security_.isEmpty()) { + if (securityBuilder_.isEmpty()) { + securityBuilder_.dispose(); + securityBuilder_ = null; + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000800); + securityBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSecurityFieldBuilder() : null; + } else { + securityBuilder_.addAllMessages(other.security_); + } + } + } + if (!other.defaultInputModes_.isEmpty()) { + if (defaultInputModes_.isEmpty()) { + defaultInputModes_ = other.defaultInputModes_; + bitField0_ |= 0x00001000; + } else { + ensureDefaultInputModesIsMutable(); + defaultInputModes_.addAll(other.defaultInputModes_); + } + onChanged(); + } + if (!other.defaultOutputModes_.isEmpty()) { + if (defaultOutputModes_.isEmpty()) { + defaultOutputModes_ = other.defaultOutputModes_; + bitField0_ |= 0x00002000; + } else { + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.addAll(other.defaultOutputModes_); + } + onChanged(); + } + if (skillsBuilder_ == null) { + if (!other.skills_.isEmpty()) { + if (skills_.isEmpty()) { + skills_ = other.skills_; + bitField0_ = (bitField0_ & ~0x00004000); + } else { + ensureSkillsIsMutable(); + skills_.addAll(other.skills_); + } + onChanged(); + } + } else { + if (!other.skills_.isEmpty()) { + if (skillsBuilder_.isEmpty()) { + skillsBuilder_.dispose(); + skillsBuilder_ = null; + skills_ = other.skills_; + bitField0_ = (bitField0_ & ~0x00004000); + skillsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSkillsFieldBuilder() : null; + } else { + skillsBuilder_.addAllMessages(other.skills_); + } + } + } + if (other.getSupportsAuthenticatedExtendedCard() != false) { + setSupportsAuthenticatedExtendedCard(other.getSupportsAuthenticatedExtendedCard()); + } + if (signaturesBuilder_ == null) { + if (!other.signatures_.isEmpty()) { + if (signatures_.isEmpty()) { + signatures_ = other.signatures_; + bitField0_ = (bitField0_ & ~0x00010000); + } else { + ensureSignaturesIsMutable(); + signatures_.addAll(other.signatures_); + } + onChanged(); + } + } else { + if (!other.signatures_.isEmpty()) { + if (signaturesBuilder_.isEmpty()) { + signaturesBuilder_.dispose(); + signaturesBuilder_ = null; + signatures_ = other.signatures_; + bitField0_ = (bitField0_ & ~0x00010000); + signaturesBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSignaturesFieldBuilder() : null; + } else { + signaturesBuilder_.addAllMessages(other.signatures_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 10 + case 18: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 18 + case 26: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetProviderFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000040; + break; + } // case 34 + case 42: { + version_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000080; + break; + } // case 42 + case 50: { + documentationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000100; + break; + } // case 50 + case 58: { + input.readMessage( + internalGetCapabilitiesFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000200; + break; + } // case 58 + case 66: { + com.google.protobuf.MapEntry + securitySchemes__ = input.readMessage( + SecuritySchemesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableSecuritySchemes().ensureBuilderMap().put( + securitySchemes__.getKey(), securitySchemes__.getValue()); + bitField0_ |= 0x00000400; + break; + } // case 66 + case 74: { + org.a2aproject.sdk.compat03.grpc.Security m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Security.parser(), + extensionRegistry); + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(m); + } else { + securityBuilder_.addMessage(m); + } + break; + } // case 74 + case 82: { + java.lang.String s = input.readStringRequireUtf8(); + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(s); + break; + } // case 82 + case 90: { + java.lang.String s = input.readStringRequireUtf8(); + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(s); + break; + } // case 90 + case 98: { + org.a2aproject.sdk.compat03.grpc.AgentSkill m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentSkill.parser(), + extensionRegistry); + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(m); + } else { + skillsBuilder_.addMessage(m); + } + break; + } // case 98 + case 104: { + supportsAuthenticatedExtendedCard_ = input.readBool(); + bitField0_ |= 0x00008000; + break; + } // case 104 + case 114: { + preferredTransport_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000010; + break; + } // case 114 + case 122: { + org.a2aproject.sdk.compat03.grpc.AgentInterface m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentInterface.parser(), + extensionRegistry); + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(m); + } else { + additionalInterfacesBuilder_.addMessage(m); + } + break; + } // case 122 + case 130: { + protocolVersion_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 130 + case 138: { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.parser(), + extensionRegistry); + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(m); + } else { + signaturesBuilder_.addMessage(m); + } + break; + } // case 138 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object protocolVersion_ = ""; + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + public java.lang.String getProtocolVersion() { + java.lang.Object ref = protocolVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protocolVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + public com.google.protobuf.ByteString + getProtocolVersionBytes() { + java.lang.Object ref = protocolVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protocolVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @param value The protocolVersion to set. + * @return This builder for chaining. + */ + public Builder setProtocolVersion( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + protocolVersion_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @return This builder for chaining. + */ + public Builder clearProtocolVersion() { + protocolVersion_ = getDefaultInstance().getProtocolVersion(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The version of the A2A protocol this agent supports.
+     * 
+ * + * string protocol_version = 16; + * @param value The bytes for protocolVersion to set. + * @return This builder for chaining. + */ + public Builder setProtocolVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + protocolVersion_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the agent.
+     * Example: "Recipe Agent"
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A description of the agent's domain of action/solution space.
+     * Example: "Agent that helps users with recipes and cooking."
+     * 
+ * + * string description = 2; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.lang.Object url_ = ""; + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + *
+     * A URL to the address the agent is hosted at. This represents the
+     * preferred endpoint as declared by the agent.
+     * 
+ * + * string url = 3; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private java.lang.Object preferredTransport_ = ""; + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + public java.lang.String getPreferredTransport() { + java.lang.Object ref = preferredTransport_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + preferredTransport_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + public com.google.protobuf.ByteString + getPreferredTransportBytes() { + java.lang.Object ref = preferredTransport_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + preferredTransport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @param value The preferredTransport to set. + * @return This builder for chaining. + */ + public Builder setPreferredTransport( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + preferredTransport_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @return This builder for chaining. + */ + public Builder clearPreferredTransport() { + preferredTransport_ = getDefaultInstance().getPreferredTransport(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + *
+     * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+     * 
+ * + * string preferred_transport = 14; + * @param value The bytes for preferredTransport to set. + * @return This builder for chaining. + */ + public Builder setPreferredTransportBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + preferredTransport_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private java.util.List additionalInterfaces_ = + java.util.Collections.emptyList(); + private void ensureAdditionalInterfacesIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + additionalInterfaces_ = new java.util.ArrayList(additionalInterfaces_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder> additionalInterfacesBuilder_; + + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List getAdditionalInterfacesList() { + if (additionalInterfacesBuilder_ == null) { + return java.util.Collections.unmodifiableList(additionalInterfaces_); + } else { + return additionalInterfacesBuilder_.getMessageList(); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public int getAdditionalInterfacesCount() { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.size(); + } else { + return additionalInterfacesBuilder_.getCount(); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index) { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.get(index); + } else { + return additionalInterfacesBuilder_.getMessage(index); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder setAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.set(index, value); + onChanged(); + } else { + additionalInterfacesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder setAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.set(index, builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces(org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(value); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface value) { + if (additionalInterfacesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(index, value); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAdditionalInterfaces( + int index, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builderForValue) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.add(index, builderForValue.build()); + onChanged(); + } else { + additionalInterfacesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder addAllAdditionalInterfaces( + java.lang.Iterable values) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, additionalInterfaces_); + onChanged(); + } else { + additionalInterfacesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder clearAdditionalInterfaces() { + if (additionalInterfacesBuilder_ == null) { + additionalInterfaces_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + additionalInterfacesBuilder_.clear(); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public Builder removeAdditionalInterfaces(int index) { + if (additionalInterfacesBuilder_ == null) { + ensureAdditionalInterfacesIsMutable(); + additionalInterfaces_.remove(index); + onChanged(); + } else { + additionalInterfacesBuilder_.remove(index); + } + return this; + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder getAdditionalInterfacesBuilder( + int index) { + return internalGetAdditionalInterfacesFieldBuilder().getBuilder(index); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index) { + if (additionalInterfacesBuilder_ == null) { + return additionalInterfaces_.get(index); } else { + return additionalInterfacesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List + getAdditionalInterfacesOrBuilderList() { + if (additionalInterfacesBuilder_ != null) { + return additionalInterfacesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(additionalInterfaces_); + } + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder addAdditionalInterfacesBuilder() { + return internalGetAdditionalInterfacesFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder addAdditionalInterfacesBuilder( + int index) { + return internalGetAdditionalInterfacesFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()); + } + /** + *
+     * Announcement of additional supported transports. Client can use any of
+     * the supported transports.
+     * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + public java.util.List + getAdditionalInterfacesBuilderList() { + return internalGetAdditionalInterfacesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder> + internalGetAdditionalInterfacesFieldBuilder() { + if (additionalInterfacesBuilder_ == null) { + additionalInterfacesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentInterface, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder, org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder>( + additionalInterfaces_, + ((bitField0_ & 0x00000020) != 0), + getParentForChildren(), + isClean()); + additionalInterfaces_ = null; + } + return additionalInterfacesBuilder_; + } + + private org.a2aproject.sdk.compat03.grpc.AgentProvider provider_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder> providerBuilder_; + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + public boolean hasProvider() { + return ((bitField0_ & 0x00000040) != 0); + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + public org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider() { + if (providerBuilder_ == null) { + return provider_ == null ? org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } else { + return providerBuilder_.getMessage(); + } + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder setProvider(org.a2aproject.sdk.compat03.grpc.AgentProvider value) { + if (providerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + provider_ = value; + } else { + providerBuilder_.setMessage(value); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder setProvider( + org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder builderForValue) { + if (providerBuilder_ == null) { + provider_ = builderForValue.build(); + } else { + providerBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder mergeProvider(org.a2aproject.sdk.compat03.grpc.AgentProvider value) { + if (providerBuilder_ == null) { + if (((bitField0_ & 0x00000040) != 0) && + provider_ != null && + provider_ != org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance()) { + getProviderBuilder().mergeFrom(value); + } else { + provider_ = value; + } + } else { + providerBuilder_.mergeFrom(value); + } + if (provider_ != null) { + bitField0_ |= 0x00000040; + onChanged(); + } + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public Builder clearProvider() { + bitField0_ = (bitField0_ & ~0x00000040); + provider_ = null; + if (providerBuilder_ != null) { + providerBuilder_.dispose(); + providerBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder getProviderBuilder() { + bitField0_ |= 0x00000040; + onChanged(); + return internalGetProviderFieldBuilder().getBuilder(); + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder() { + if (providerBuilder_ != null) { + return providerBuilder_.getMessageOrBuilder(); + } else { + return provider_ == null ? + org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance() : provider_; + } + } + /** + *
+     * The service provider of the agent.
+     * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder> + internalGetProviderFieldBuilder() { + if (providerBuilder_ == null) { + providerBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentProvider, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder, org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder>( + getProvider(), + getParentForChildren(), + isClean()); + provider_ = null; + } + return providerBuilder_; + } + + private java.lang.Object version_ = ""; + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return The version. + */ + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return The bytes for version. + */ + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + version_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @return This builder for chaining. + */ + public Builder clearVersion() { + version_ = getDefaultInstance().getVersion(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + return this; + } + /** + *
+     * The version of the agent.
+     * Example: "1.0.0"
+     * 
+ * + * string version = 5; + * @param value The bytes for version to set. + * @return This builder for chaining. + */ + public Builder setVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + version_ = value; + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + + private java.lang.Object documentationUrl_ = ""; + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + public java.lang.String getDocumentationUrl() { + java.lang.Object ref = documentationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + documentationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + public com.google.protobuf.ByteString + getDocumentationUrlBytes() { + java.lang.Object ref = documentationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + documentationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @param value The documentationUrl to set. + * @return This builder for chaining. + */ + public Builder setDocumentationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + documentationUrl_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @return This builder for chaining. + */ + public Builder clearDocumentationUrl() { + documentationUrl_ = getDefaultInstance().getDocumentationUrl(); + bitField0_ = (bitField0_ & ~0x00000100); + onChanged(); + return this; + } + /** + *
+     * A url to provide additional documentation about the agent.
+     * 
+ * + * string documentation_url = 6; + * @param value The bytes for documentationUrl to set. + * @return This builder for chaining. + */ + public Builder setDocumentationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + documentationUrl_ = value; + bitField0_ |= 0x00000100; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.AgentCapabilities capabilities_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder> capabilitiesBuilder_; + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + public boolean hasCapabilities() { + return ((bitField0_ & 0x00000200) != 0); + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities() { + if (capabilitiesBuilder_ == null) { + return capabilities_ == null ? org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } else { + return capabilitiesBuilder_.getMessage(); + } + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder setCapabilities(org.a2aproject.sdk.compat03.grpc.AgentCapabilities value) { + if (capabilitiesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + capabilities_ = value; + } else { + capabilitiesBuilder_.setMessage(value); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder setCapabilities( + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder builderForValue) { + if (capabilitiesBuilder_ == null) { + capabilities_ = builderForValue.build(); + } else { + capabilitiesBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000200; + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder mergeCapabilities(org.a2aproject.sdk.compat03.grpc.AgentCapabilities value) { + if (capabilitiesBuilder_ == null) { + if (((bitField0_ & 0x00000200) != 0) && + capabilities_ != null && + capabilities_ != org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance()) { + getCapabilitiesBuilder().mergeFrom(value); + } else { + capabilities_ = value; + } + } else { + capabilitiesBuilder_.mergeFrom(value); + } + if (capabilities_ != null) { + bitField0_ |= 0x00000200; + onChanged(); + } + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public Builder clearCapabilities() { + bitField0_ = (bitField0_ & ~0x00000200); + capabilities_ = null; + if (capabilitiesBuilder_ != null) { + capabilitiesBuilder_.dispose(); + capabilitiesBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder getCapabilitiesBuilder() { + bitField0_ |= 0x00000200; + onChanged(); + return internalGetCapabilitiesFieldBuilder().getBuilder(); + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder() { + if (capabilitiesBuilder_ != null) { + return capabilitiesBuilder_.getMessageOrBuilder(); + } else { + return capabilities_ == null ? + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.getDefaultInstance() : capabilities_; + } + } + /** + *
+     * A2A Capability set supported by the agent.
+     * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder> + internalGetCapabilitiesFieldBuilder() { + if (capabilitiesBuilder_ == null) { + capabilitiesBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCapabilities, org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder, org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder>( + getCapabilities(), + getParentForChildren(), + isClean()); + capabilities_ = null; + } + return capabilitiesBuilder_; + } + + private static final class SecuritySchemesConverter implements com.google.protobuf.MapFieldBuilder.Converter { + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme build(org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder val) { + if (val instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { return (org.a2aproject.sdk.compat03.grpc.SecurityScheme) val; } + return ((org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry defaultEntry() { + return SecuritySchemesDefaultEntryHolder.defaultEntry; + } + }; + private static final SecuritySchemesConverter securitySchemesConverter = new SecuritySchemesConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder, org.a2aproject.sdk.compat03.grpc.SecurityScheme, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder> securitySchemes_; + private com.google.protobuf.MapFieldBuilder + internalGetSecuritySchemes() { + if (securitySchemes_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(securitySchemesConverter); + } + return securitySchemes_; + } + private com.google.protobuf.MapFieldBuilder + internalGetMutableSecuritySchemes() { + if (securitySchemes_ == null) { + securitySchemes_ = new com.google.protobuf.MapFieldBuilder<>(securitySchemesConverter); + } + bitField0_ |= 0x00000400; + onChanged(); + return securitySchemes_; + } + public int getSecuritySchemesCount() { + return internalGetSecuritySchemes().ensureBuilderMap().size(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public boolean containsSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSecuritySchemes().ensureBuilderMap().containsKey(key); + } + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSecuritySchemes() { + return getSecuritySchemesMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public java.util.Map getSecuritySchemesMap() { + return internalGetSecuritySchemes().getImmutableMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSecuritySchemes().ensureBuilderMap(); + return map.containsKey(key) ? securitySchemesConverter.build(map.get(key)) : defaultValue; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSecuritySchemes().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return securitySchemesConverter.build(map.get(key)); + } + public Builder clearSecuritySchemes() { + bitField0_ = (bitField0_ & ~0x00000400); + internalGetMutableSecuritySchemes().clear(); + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder removeSecuritySchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableSecuritySchemes() { + bitField0_ |= 0x00000400; + return internalGetMutableSecuritySchemes().ensureMessageMap(); + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder putSecuritySchemes( + java.lang.String key, + org.a2aproject.sdk.compat03.grpc.SecurityScheme value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .put(key, value); + bitField0_ |= 0x00000400; + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public Builder putAllSecuritySchemes( + java.util.Map values) { + for (java.util.Map.Entry e : values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableSecuritySchemes().ensureBuilderMap() + .putAll(values); + bitField0_ |= 0x00000400; + return this; + } + /** + *
+     * The security scheme details used for authenticating with this agent.
+     * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder putSecuritySchemesBuilderIfAbsent( + java.lang.String key) { + java.util.Map builderMap = internalGetMutableSecuritySchemes().ensureBuilderMap(); + org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { + entry = ((org.a2aproject.sdk.compat03.grpc.SecurityScheme) entry).toBuilder(); + builderMap.put(key, entry); + } + return (org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder) entry; + } + + private java.util.List security_ = + java.util.Collections.emptyList(); + private void ensureSecurityIsMutable() { + if (!((bitField0_ & 0x00000800) != 0)) { + security_ = new java.util.ArrayList(security_); + bitField0_ |= 0x00000800; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> securityBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List getSecurityList() { + if (securityBuilder_ == null) { + return java.util.Collections.unmodifiableList(security_); + } else { + return securityBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public int getSecurityCount() { + if (securityBuilder_ == null) { + return security_.size(); + } else { + return securityBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + if (securityBuilder_ == null) { + return security_.get(index); + } else { + return securityBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.set(index, value); + onChanged(); + } else { + securityBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.set(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity(org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(value); + onChanged(); + } else { + securityBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(index, value); + onChanged(); + } else { + securityBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder addAllSecurity( + java.lang.Iterable values) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, security_); + onChanged(); + } else { + securityBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder clearSecurity() { + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000800); + onChanged(); + } else { + securityBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public Builder removeSecurity(int index) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.remove(index); + onChanged(); + } else { + securityBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder getSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + if (securityBuilder_ == null) { + return security_.get(index); } else { + return securityBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List + getSecurityOrBuilderList() { + if (securityBuilder_ != null) { + return securityBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(security_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder() { + return internalGetSecurityFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security requirements for contacting the agent.
+     * This list can be seen as an OR of ANDs. Each object in the list describes
+     * one possible set of security requirements that must be present on a
+     * request. This allows specifying, for example, "callers must either use
+     * OAuth OR an API Key AND mTLS."
+     * Example:
+     * security {
+     * schemes { key: "oauth" value { list: ["read"] } }
+     * }
+     * security {
+     * schemes { key: "api-key" }
+     * schemes { key: "mtls" }
+     * }
+     * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + public java.util.List + getSecurityBuilderList() { + return internalGetSecurityFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> + internalGetSecurityFieldBuilder() { + if (securityBuilder_ == null) { + securityBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder>( + security_, + ((bitField0_ & 0x00000800) != 0), + getParentForChildren(), + isClean()); + security_ = null; + } + return securityBuilder_; + } + + private com.google.protobuf.LazyStringArrayList defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureDefaultInputModesIsMutable() { + if (!defaultInputModes_.isModifiable()) { + defaultInputModes_ = new com.google.protobuf.LazyStringArrayList(defaultInputModes_); + } + bitField0_ |= 0x00001000; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultInputModesList() { + defaultInputModes_.makeImmutable(); + return defaultInputModes_; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + public int getDefaultInputModesCount() { + return defaultInputModes_.size(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + public java.lang.String getDefaultInputModes(int index) { + return defaultInputModes_.get(index); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultInputModesBytes(int index) { + return defaultInputModes_.getByteString(index); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param index The index to set the value at. + * @param value The defaultInputModes to set. + * @return This builder for chaining. + */ + public Builder setDefaultInputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultInputModesIsMutable(); + defaultInputModes_.set(index, value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param value The defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultInputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param values The defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addAllDefaultInputModes( + java.lang.Iterable values) { + ensureDefaultInputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, defaultInputModes_); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @return This builder for chaining. + */ + public Builder clearDefaultInputModes() { + defaultInputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00001000);; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * The set of interaction modes that the agent supports across all skills.
+     * This can be overridden per skill. Defined as mime types.
+     * 
+ * + * repeated string default_input_modes = 10; + * @param value The bytes of the defaultInputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultInputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureDefaultInputModesIsMutable(); + defaultInputModes_.add(value); + bitField0_ |= 0x00001000; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureDefaultOutputModesIsMutable() { + if (!defaultOutputModes_.isModifiable()) { + defaultOutputModes_ = new com.google.protobuf.LazyStringArrayList(defaultOutputModes_); + } + bitField0_ |= 0x00002000; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getDefaultOutputModesList() { + defaultOutputModes_.makeImmutable(); + return defaultOutputModes_; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + public int getDefaultOutputModesCount() { + return defaultOutputModes_.size(); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + public java.lang.String getDefaultOutputModes(int index) { + return defaultOutputModes_.get(index); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index) { + return defaultOutputModes_.getByteString(index); + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param index The index to set the value at. + * @param value The defaultOutputModes to set. + * @return This builder for chaining. + */ + public Builder setDefaultOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.set(index, value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param value The defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param values The defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAllDefaultOutputModes( + java.lang.Iterable values) { + ensureDefaultOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, defaultOutputModes_); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @return This builder for chaining. + */ + public Builder clearDefaultOutputModes() { + defaultOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00002000);; + onChanged(); + return this; + } + /** + *
+     * The mime types supported as outputs from this agent.
+     * 
+ * + * repeated string default_output_modes = 11; + * @param value The bytes of the defaultOutputModes to add. + * @return This builder for chaining. + */ + public Builder addDefaultOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureDefaultOutputModesIsMutable(); + defaultOutputModes_.add(value); + bitField0_ |= 0x00002000; + onChanged(); + return this; + } + + private java.util.List skills_ = + java.util.Collections.emptyList(); + private void ensureSkillsIsMutable() { + if (!((bitField0_ & 0x00004000) != 0)) { + skills_ = new java.util.ArrayList(skills_); + bitField0_ |= 0x00004000; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder> skillsBuilder_; + + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List getSkillsList() { + if (skillsBuilder_ == null) { + return java.util.Collections.unmodifiableList(skills_); + } else { + return skillsBuilder_.getMessageList(); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public int getSkillsCount() { + if (skillsBuilder_ == null) { + return skills_.size(); + } else { + return skillsBuilder_.getCount(); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index) { + if (skillsBuilder_ == null) { + return skills_.get(index); + } else { + return skillsBuilder_.getMessage(index); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder setSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.set(index, value); + onChanged(); + } else { + skillsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder setSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.set(index, builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills(org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.add(value); + onChanged(); + } else { + skillsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill value) { + if (skillsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkillsIsMutable(); + skills_.add(index, value); + onChanged(); + } else { + skillsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addSkills( + int index, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builderForValue) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.add(index, builderForValue.build()); + onChanged(); + } else { + skillsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder addAllSkills( + java.lang.Iterable values) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, skills_); + onChanged(); + } else { + skillsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder clearSkills() { + if (skillsBuilder_ == null) { + skills_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00004000); + onChanged(); + } else { + skillsBuilder_.clear(); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public Builder removeSkills(int index) { + if (skillsBuilder_ == null) { + ensureSkillsIsMutable(); + skills_.remove(index); + onChanged(); + } else { + skillsBuilder_.remove(index); + } + return this; + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder getSkillsBuilder( + int index) { + return internalGetSkillsFieldBuilder().getBuilder(index); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index) { + if (skillsBuilder_ == null) { + return skills_.get(index); } else { + return skillsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List + getSkillsOrBuilderList() { + if (skillsBuilder_ != null) { + return skillsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(skills_); + } + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder addSkillsBuilder() { + return internalGetSkillsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder addSkillsBuilder( + int index) { + return internalGetSkillsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()); + } + /** + *
+     * Skills represent a unit of ability an agent can perform. This may
+     * somewhat abstract but represents a more focused set of actions that the
+     * agent is highly likely to succeed at.
+     * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + public java.util.List + getSkillsBuilderList() { + return internalGetSkillsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder> + internalGetSkillsFieldBuilder() { + if (skillsBuilder_ == null) { + skillsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentSkill, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder, org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder>( + skills_, + ((bitField0_ & 0x00004000) != 0), + getParentForChildren(), + isClean()); + skills_ = null; + } + return skillsBuilder_; + } + + private boolean supportsAuthenticatedExtendedCard_ ; + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + @java.lang.Override + public boolean getSupportsAuthenticatedExtendedCard() { + return supportsAuthenticatedExtendedCard_; + } + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @param value The supportsAuthenticatedExtendedCard to set. + * @return This builder for chaining. + */ + public Builder setSupportsAuthenticatedExtendedCard(boolean value) { + + supportsAuthenticatedExtendedCard_ = value; + bitField0_ |= 0x00008000; + onChanged(); + return this; + } + /** + *
+     * Whether the agent supports providing an extended agent card when
+     * the user is authenticated, i.e. is the card from .well-known
+     * different than the card from GetAgentCard.
+     * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return This builder for chaining. + */ + public Builder clearSupportsAuthenticatedExtendedCard() { + bitField0_ = (bitField0_ & ~0x00008000); + supportsAuthenticatedExtendedCard_ = false; + onChanged(); + return this; + } + + private java.util.List signatures_ = + java.util.Collections.emptyList(); + private void ensureSignaturesIsMutable() { + if (!((bitField0_ & 0x00010000) != 0)) { + signatures_ = new java.util.ArrayList(signatures_); + bitField0_ |= 0x00010000; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder> signaturesBuilder_; + + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List getSignaturesList() { + if (signaturesBuilder_ == null) { + return java.util.Collections.unmodifiableList(signatures_); + } else { + return signaturesBuilder_.getMessageList(); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public int getSignaturesCount() { + if (signaturesBuilder_ == null) { + return signatures_.size(); + } else { + return signaturesBuilder_.getCount(); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index) { + if (signaturesBuilder_ == null) { + return signatures_.get(index); + } else { + return signaturesBuilder_.getMessage(index); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder setSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.set(index, value); + onChanged(); + } else { + signaturesBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder setSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.set(index, builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures(org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.add(value); + onChanged(); + } else { + signaturesBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature value) { + if (signaturesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSignaturesIsMutable(); + signatures_.add(index, value); + onChanged(); + } else { + signaturesBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addSignatures( + int index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builderForValue) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.add(index, builderForValue.build()); + onChanged(); + } else { + signaturesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder addAllSignatures( + java.lang.Iterable values) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, signatures_); + onChanged(); + } else { + signaturesBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder clearSignatures() { + if (signaturesBuilder_ == null) { + signatures_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00010000); + onChanged(); + } else { + signaturesBuilder_.clear(); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public Builder removeSignatures(int index) { + if (signaturesBuilder_ == null) { + ensureSignaturesIsMutable(); + signatures_.remove(index); + onChanged(); + } else { + signaturesBuilder_.remove(index); + } + return this; + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder getSignaturesBuilder( + int index) { + return internalGetSignaturesFieldBuilder().getBuilder(index); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index) { + if (signaturesBuilder_ == null) { + return signatures_.get(index); } else { + return signaturesBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List + getSignaturesOrBuilderList() { + if (signaturesBuilder_ != null) { + return signaturesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(signatures_); + } + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder addSignaturesBuilder() { + return internalGetSignaturesFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder addSignaturesBuilder( + int index) { + return internalGetSignaturesFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()); + } + /** + *
+     * JSON Web Signatures computed for this AgentCard.
+     * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + public java.util.List + getSignaturesBuilderList() { + return internalGetSignaturesFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder> + internalGetSignaturesFieldBuilder() { + if (signaturesBuilder_ == null) { + signaturesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AgentCardSignature, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder, org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder>( + signatures_, + ((bitField0_ & 0x00010000) != 0), + getParentForChildren(), + isClean()); + signatures_ = null; + } + return signaturesBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCard) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCard) + private static final org.a2aproject.sdk.compat03.grpc.AgentCard DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCard(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCard parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCard getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java new file mode 100644 index 000000000..43a03abd3 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardOrBuilder.java @@ -0,0 +1,626 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCardOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCard) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The protocolVersion. + */ + java.lang.String getProtocolVersion(); + /** + *
+   * The version of the A2A protocol this agent supports.
+   * 
+ * + * string protocol_version = 16; + * @return The bytes for protocolVersion. + */ + com.google.protobuf.ByteString + getProtocolVersionBytes(); + + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the agent.
+   * Example: "Recipe Agent"
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A description of the agent's domain of action/solution space.
+   * Example: "Agent that helps users with recipes and cooking."
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * A URL to the address the agent is hosted at. This represents the
+   * preferred endpoint as declared by the agent.
+   * 
+ * + * string url = 3; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The preferredTransport. + */ + java.lang.String getPreferredTransport(); + /** + *
+   * The transport of the preferred endpoint. If empty, defaults to JSONRPC.
+   * 
+ * + * string preferred_transport = 14; + * @return The bytes for preferredTransport. + */ + com.google.protobuf.ByteString + getPreferredTransportBytes(); + + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + java.util.List + getAdditionalInterfacesList(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + org.a2aproject.sdk.compat03.grpc.AgentInterface getAdditionalInterfaces(int index); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + int getAdditionalInterfacesCount(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + java.util.List + getAdditionalInterfacesOrBuilderList(); + /** + *
+   * Announcement of additional supported transports. Client can use any of
+   * the supported transports.
+   * 
+ * + * repeated .a2a.v1.AgentInterface additional_interfaces = 15; + */ + org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder getAdditionalInterfacesOrBuilder( + int index); + + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return Whether the provider field is set. + */ + boolean hasProvider(); + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + * @return The provider. + */ + org.a2aproject.sdk.compat03.grpc.AgentProvider getProvider(); + /** + *
+   * The service provider of the agent.
+   * 
+ * + * .a2a.v1.AgentProvider provider = 4; + */ + org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder getProviderOrBuilder(); + + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The version. + */ + java.lang.String getVersion(); + /** + *
+   * The version of the agent.
+   * Example: "1.0.0"
+   * 
+ * + * string version = 5; + * @return The bytes for version. + */ + com.google.protobuf.ByteString + getVersionBytes(); + + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The documentationUrl. + */ + java.lang.String getDocumentationUrl(); + /** + *
+   * A url to provide additional documentation about the agent.
+   * 
+ * + * string documentation_url = 6; + * @return The bytes for documentationUrl. + */ + com.google.protobuf.ByteString + getDocumentationUrlBytes(); + + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return Whether the capabilities field is set. + */ + boolean hasCapabilities(); + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + * @return The capabilities. + */ + org.a2aproject.sdk.compat03.grpc.AgentCapabilities getCapabilities(); + /** + *
+   * A2A Capability set supported by the agent.
+   * 
+ * + * .a2a.v1.AgentCapabilities capabilities = 7; + */ + org.a2aproject.sdk.compat03.grpc.AgentCapabilitiesOrBuilder getCapabilitiesOrBuilder(); + + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + int getSecuritySchemesCount(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + boolean containsSecuritySchemes( + java.lang.String key); + /** + * Use {@link #getSecuritySchemesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getSecuritySchemes(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + java.util.Map + getSecuritySchemesMap(); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.SecurityScheme defaultValue); + /** + *
+   * The security scheme details used for authenticating with this agent.
+   * 
+ * + * map<string, .a2a.v1.SecurityScheme> security_schemes = 8; + */ + org.a2aproject.sdk.compat03.grpc.SecurityScheme getSecuritySchemesOrThrow( + java.lang.String key); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + java.util.List + getSecurityList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + int getSecurityCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + java.util.List + getSecurityOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security requirements for contacting the agent.
+   * This list can be seen as an OR of ANDs. Each object in the list describes
+   * one possible set of security requirements that must be present on a
+   * request. This allows specifying, for example, "callers must either use
+   * OAuth OR an API Key AND mTLS."
+   * Example:
+   * security {
+   * schemes { key: "oauth" value { list: ["read"] } }
+   * }
+   * security {
+   * schemes { key: "api-key" }
+   * schemes { key: "mtls" }
+   * }
+   * 
+ * + * repeated .a2a.v1.Security security = 9; + */ + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return A list containing the defaultInputModes. + */ + java.util.List + getDefaultInputModesList(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @return The count of defaultInputModes. + */ + int getDefaultInputModesCount(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the element to return. + * @return The defaultInputModes at the given index. + */ + java.lang.String getDefaultInputModes(int index); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * The set of interaction modes that the agent supports across all skills.
+   * This can be overridden per skill. Defined as mime types.
+   * 
+ * + * repeated string default_input_modes = 10; + * @param index The index of the value to return. + * @return The bytes of the defaultInputModes at the given index. + */ + com.google.protobuf.ByteString + getDefaultInputModesBytes(int index); + + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return A list containing the defaultOutputModes. + */ + java.util.List + getDefaultOutputModesList(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @return The count of defaultOutputModes. + */ + int getDefaultOutputModesCount(); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the element to return. + * @return The defaultOutputModes at the given index. + */ + java.lang.String getDefaultOutputModes(int index); + /** + *
+   * The mime types supported as outputs from this agent.
+   * 
+ * + * repeated string default_output_modes = 11; + * @param index The index of the value to return. + * @return The bytes of the defaultOutputModes at the given index. + */ + com.google.protobuf.ByteString + getDefaultOutputModesBytes(int index); + + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + java.util.List + getSkillsList(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + org.a2aproject.sdk.compat03.grpc.AgentSkill getSkills(int index); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + int getSkillsCount(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + java.util.List + getSkillsOrBuilderList(); + /** + *
+   * Skills represent a unit of ability an agent can perform. This may
+   * somewhat abstract but represents a more focused set of actions that the
+   * agent is highly likely to succeed at.
+   * 
+ * + * repeated .a2a.v1.AgentSkill skills = 12; + */ + org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder getSkillsOrBuilder( + int index); + + /** + *
+   * Whether the agent supports providing an extended agent card when
+   * the user is authenticated, i.e. is the card from .well-known
+   * different than the card from GetAgentCard.
+   * 
+ * + * bool supports_authenticated_extended_card = 13; + * @return The supportsAuthenticatedExtendedCard. + */ + boolean getSupportsAuthenticatedExtendedCard(); + + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + java.util.List + getSignaturesList(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + org.a2aproject.sdk.compat03.grpc.AgentCardSignature getSignatures(int index); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + int getSignaturesCount(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + java.util.List + getSignaturesOrBuilderList(); + /** + *
+   * JSON Web Signatures computed for this AgentCard.
+   * 
+ * + * repeated .a2a.v1.AgentCardSignature signatures = 17; + */ + org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder getSignaturesOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java new file mode 100644 index 000000000..161a10234 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignature.java @@ -0,0 +1,952 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentCardSignature represents a JWS signature of an AgentCard.
+ * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentCardSignature} + */ +@com.google.protobuf.Generated +public final class AgentCardSignature extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentCardSignature) + AgentCardSignatureOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentCardSignature"); + } + // Use AgentCardSignature.newBuilder() to construct. + private AgentCardSignature(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentCardSignature() { + protected_ = ""; + signature_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.class, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder.class); + } + + private int bitField0_; + public static final int PROTECTED_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object protected_ = ""; + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + @java.lang.Override + public java.lang.String getProtected() { + java.lang.Object ref = protected_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protected_ = s; + return s; + } + } + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getProtectedBytes() { + java.lang.Object ref = protected_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protected_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SIGNATURE_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object signature_ = ""; + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + @java.lang.Override + public java.lang.String getSignature() { + java.lang.Object ref = signature_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + signature_ = s; + return s; + } + } + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getSignatureBytes() { + java.lang.Object ref = signature_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + signature_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HEADER_FIELD_NUMBER = 3; + private com.google.protobuf.Struct header_; + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + @java.lang.Override + public boolean hasHeader() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + @java.lang.Override + public com.google.protobuf.Struct getHeader() { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getHeaderOrBuilder() { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protected_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, protected_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(signature_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, signature_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getHeader()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(protected_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, protected_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(signature_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, signature_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getHeader()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentCardSignature)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentCardSignature other = (org.a2aproject.sdk.compat03.grpc.AgentCardSignature) obj; + + if (!getProtected() + .equals(other.getProtected())) return false; + if (!getSignature() + .equals(other.getSignature())) return false; + if (hasHeader() != other.hasHeader()) return false; + if (hasHeader()) { + if (!getHeader() + .equals(other.getHeader())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PROTECTED_FIELD_NUMBER; + hash = (53 * hash) + getProtected().hashCode(); + hash = (37 * hash) + SIGNATURE_FIELD_NUMBER; + hash = (53 * hash) + getSignature().hashCode(); + if (hasHeader()) { + hash = (37 * hash) + HEADER_FIELD_NUMBER; + hash = (53 * hash) + getHeader().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentCardSignature prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentCardSignature represents a JWS signature of an AgentCard.
+   * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentCardSignature} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentCardSignature) + org.a2aproject.sdk.compat03.grpc.AgentCardSignatureOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCardSignature_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.class, org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentCardSignature.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetHeaderFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + protected_ = ""; + signature_ = ""; + header_ = null; + if (headerBuilder_ != null) { + headerBuilder_.dispose(); + headerBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentCardSignature_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature build() { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature result = new org.a2aproject.sdk.compat03.grpc.AgentCardSignature(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentCardSignature result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.protected_ = protected_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.signature_ = signature_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.header_ = headerBuilder_ == null + ? header_ + : headerBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentCardSignature) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentCardSignature)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentCardSignature other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentCardSignature.getDefaultInstance()) return this; + if (!other.getProtected().isEmpty()) { + protected_ = other.protected_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getSignature().isEmpty()) { + signature_ = other.signature_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasHeader()) { + mergeHeader(other.getHeader()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + protected_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + signature_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetHeaderFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object protected_ = ""; + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + public java.lang.String getProtected() { + java.lang.Object ref = protected_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + protected_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + public com.google.protobuf.ByteString + getProtectedBytes() { + java.lang.Object ref = protected_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + protected_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The protected to set. + * @return This builder for chaining. + */ + public Builder setProtected( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + protected_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearProtected() { + protected_ = getDefaultInstance().getProtected(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The protected JWS header for the signature. This is always a
+     * base64url-encoded JSON object. Required.
+     * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for protected to set. + * @return This builder for chaining. + */ + public Builder setProtectedBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + protected_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object signature_ = ""; + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + public java.lang.String getSignature() { + java.lang.Object ref = signature_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + signature_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + public com.google.protobuf.ByteString + getSignatureBytes() { + java.lang.Object ref = signature_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + signature_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The signature to set. + * @return This builder for chaining. + */ + public Builder setSignature( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + signature_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearSignature() { + signature_ = getDefaultInstance().getSignature(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The computed signature, base64url-encoded. Required.
+     * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for signature to set. + * @return This builder for chaining. + */ + public Builder setSignatureBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + signature_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.Struct header_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> headerBuilder_; + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + public boolean hasHeader() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + public com.google.protobuf.Struct getHeader() { + if (headerBuilder_ == null) { + return header_ == null ? com.google.protobuf.Struct.getDefaultInstance() : header_; + } else { + return headerBuilder_.getMessage(); + } + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder setHeader(com.google.protobuf.Struct value) { + if (headerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + header_ = value; + } else { + headerBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder setHeader( + com.google.protobuf.Struct.Builder builderForValue) { + if (headerBuilder_ == null) { + header_ = builderForValue.build(); + } else { + headerBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder mergeHeader(com.google.protobuf.Struct value) { + if (headerBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + header_ != null && + header_ != com.google.protobuf.Struct.getDefaultInstance()) { + getHeaderBuilder().mergeFrom(value); + } else { + header_ = value; + } + } else { + headerBuilder_.mergeFrom(value); + } + if (header_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public Builder clearHeader() { + bitField0_ = (bitField0_ & ~0x00000004); + header_ = null; + if (headerBuilder_ != null) { + headerBuilder_.dispose(); + headerBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public com.google.protobuf.Struct.Builder getHeaderBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetHeaderFieldBuilder().getBuilder(); + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + public com.google.protobuf.StructOrBuilder getHeaderOrBuilder() { + if (headerBuilder_ != null) { + return headerBuilder_.getMessageOrBuilder(); + } else { + return header_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : header_; + } + } + /** + *
+     * The unprotected JWS header values.
+     * 
+ * + * .google.protobuf.Struct header = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetHeaderFieldBuilder() { + if (headerBuilder_ == null) { + headerBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getHeader(), + getParentForChildren(), + isClean()); + header_ = null; + } + return headerBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentCardSignature) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentCardSignature) + private static final org.a2aproject.sdk.compat03.grpc.AgentCardSignature DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentCardSignature(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentCardSignature parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentCardSignature getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java new file mode 100644 index 000000000..eb40168b0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentCardSignatureOrBuilder.java @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentCardSignatureOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentCardSignature) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The protected. + */ + java.lang.String getProtected(); + /** + *
+   * The protected JWS header for the signature. This is always a
+   * base64url-encoded JSON object. Required.
+   * 
+ * + * string protected = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for protected. + */ + com.google.protobuf.ByteString + getProtectedBytes(); + + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The signature. + */ + java.lang.String getSignature(); + /** + *
+   * The computed signature, base64url-encoded. Required.
+   * 
+ * + * string signature = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for signature. + */ + com.google.protobuf.ByteString + getSignatureBytes(); + + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return Whether the header field is set. + */ + boolean hasHeader(); + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + * @return The header. + */ + com.google.protobuf.Struct getHeader(); + /** + *
+   * The unprotected JWS header values.
+   * 
+ * + * .google.protobuf.Struct header = 3; + */ + com.google.protobuf.StructOrBuilder getHeaderOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java new file mode 100644 index 000000000..6ad9b27d1 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtension.java @@ -0,0 +1,1044 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * A declaration of an extension supported by an Agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentExtension} + */ +@com.google.protobuf.Generated +public final class AgentExtension extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentExtension) + AgentExtensionOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentExtension"); + } + // Use AgentExtension.newBuilder() to construct. + private AgentExtension(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentExtension() { + uri_ = ""; + description_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentExtension_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentExtension.class, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder.class); + } + + private int bitField0_; + public static final int URI_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object uri_ = ""; + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The uri. + */ + @java.lang.Override + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } + } + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REQUIRED_FIELD_NUMBER = 3; + private boolean required_ = false; + /** + *
+   * Whether the client must follow specific requirements of the extension.
+   * Example: false
+   * 
+ * + * bool required = 3; + * @return The required. + */ + @java.lang.Override + public boolean getRequired() { + return required_; + } + + public static final int PARAMS_FIELD_NUMBER = 4; + private com.google.protobuf.Struct params_; + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + @java.lang.Override + public boolean hasParams() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + @java.lang.Override + public com.google.protobuf.Struct getParams() { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(uri_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, uri_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, description_); + } + if (required_ != false) { + output.writeBool(3, required_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getParams()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(uri_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, uri_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, description_); + } + if (required_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(3, required_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getParams()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentExtension)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentExtension other = (org.a2aproject.sdk.compat03.grpc.AgentExtension) obj; + + if (!getUri() + .equals(other.getUri())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (getRequired() + != other.getRequired()) return false; + if (hasParams() != other.hasParams()) return false; + if (hasParams()) { + if (!getParams() + .equals(other.getParams())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URI_FIELD_NUMBER; + hash = (53 * hash) + getUri().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + REQUIRED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getRequired()); + if (hasParams()) { + hash = (37 * hash) + PARAMS_FIELD_NUMBER; + hash = (53 * hash) + getParams().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentExtension parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentExtension prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * A declaration of an extension supported by an Agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentExtension} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentExtension) + org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentExtension_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentExtension.class, org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentExtension.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetParamsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + uri_ = ""; + description_ = ""; + required_ = false; + params_ = null; + if (paramsBuilder_ != null) { + paramsBuilder_.dispose(); + paramsBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentExtension_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension build() { + org.a2aproject.sdk.compat03.grpc.AgentExtension result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentExtension result = new org.a2aproject.sdk.compat03.grpc.AgentExtension(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentExtension result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.uri_ = uri_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.required_ = required_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.params_ = paramsBuilder_ == null + ? params_ + : paramsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentExtension) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentExtension)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentExtension other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentExtension.getDefaultInstance()) return this; + if (!other.getUri().isEmpty()) { + uri_ = other.uri_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getRequired() != false) { + setRequired(other.getRequired()); + } + if (other.hasParams()) { + mergeParams(other.getParams()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + uri_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: { + required_ = input.readBool(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 34: { + input.readMessage( + internalGetParamsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object uri_ = ""; + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return The uri. + */ + public java.lang.String getUri() { + java.lang.Object ref = uri_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uri_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + public com.google.protobuf.ByteString + getUriBytes() { + java.lang.Object ref = uri_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uri_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @param value The uri to set. + * @return This builder for chaining. + */ + public Builder setUri( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @return This builder for chaining. + */ + public Builder clearUri() { + uri_ = getDefaultInstance().getUri(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The URI of the extension.
+     * Example: "https://developers.google.com/identity/protocols/oauth2"
+     * 
+ * + * string uri = 1; + * @param value The bytes for uri to set. + * @return This builder for chaining. + */ + public Builder setUriBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + uri_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A description of how this agent uses this extension.
+     * Example: "Google OAuth 2.0 authentication"
+     * 
+ * + * string description = 2; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private boolean required_ ; + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @return The required. + */ + @java.lang.Override + public boolean getRequired() { + return required_; + } + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @param value The required to set. + * @return This builder for chaining. + */ + public Builder setRequired(boolean value) { + + required_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Whether the client must follow specific requirements of the extension.
+     * Example: false
+     * 
+ * + * bool required = 3; + * @return This builder for chaining. + */ + public Builder clearRequired() { + bitField0_ = (bitField0_ & ~0x00000004); + required_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct params_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> paramsBuilder_; + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + public boolean hasParams() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + public com.google.protobuf.Struct getParams() { + if (paramsBuilder_ == null) { + return params_ == null ? com.google.protobuf.Struct.getDefaultInstance() : params_; + } else { + return paramsBuilder_.getMessage(); + } + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder setParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + params_ = value; + } else { + paramsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder setParams( + com.google.protobuf.Struct.Builder builderForValue) { + if (paramsBuilder_ == null) { + params_ = builderForValue.build(); + } else { + paramsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder mergeParams(com.google.protobuf.Struct value) { + if (paramsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && + params_ != null && + params_ != com.google.protobuf.Struct.getDefaultInstance()) { + getParamsBuilder().mergeFrom(value); + } else { + params_ = value; + } + } else { + paramsBuilder_.mergeFrom(value); + } + if (params_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public Builder clearParams() { + bitField0_ = (bitField0_ & ~0x00000008); + params_ = null; + if (paramsBuilder_ != null) { + paramsBuilder_.dispose(); + paramsBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public com.google.protobuf.Struct.Builder getParamsBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetParamsFieldBuilder().getBuilder(); + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + public com.google.protobuf.StructOrBuilder getParamsOrBuilder() { + if (paramsBuilder_ != null) { + return paramsBuilder_.getMessageOrBuilder(); + } else { + return params_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : params_; + } + } + /** + *
+     * Optional configuration for the extension.
+     * 
+ * + * .google.protobuf.Struct params = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetParamsFieldBuilder() { + if (paramsBuilder_ == null) { + paramsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getParams(), + getParentForChildren(), + isClean()); + params_ = null; + } + return paramsBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentExtension) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentExtension) + private static final org.a2aproject.sdk.compat03.grpc.AgentExtension DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentExtension(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentExtension parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentExtension getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java new file mode 100644 index 000000000..bbd435191 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentExtensionOrBuilder.java @@ -0,0 +1,94 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentExtensionOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentExtension) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The uri. + */ + java.lang.String getUri(); + /** + *
+   * The URI of the extension.
+   * Example: "https://developers.google.com/identity/protocols/oauth2"
+   * 
+ * + * string uri = 1; + * @return The bytes for uri. + */ + com.google.protobuf.ByteString + getUriBytes(); + + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A description of how this agent uses this extension.
+   * Example: "Google OAuth 2.0 authentication"
+   * 
+ * + * string description = 2; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Whether the client must follow specific requirements of the extension.
+   * Example: false
+   * 
+ * + * bool required = 3; + * @return The required. + */ + boolean getRequired(); + + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return Whether the params field is set. + */ + boolean hasParams(); + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + * @return The params. + */ + com.google.protobuf.Struct getParams(); + /** + *
+   * Optional configuration for the extension.
+   * 
+ * + * .google.protobuf.Struct params = 4; + */ + com.google.protobuf.StructOrBuilder getParamsOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java new file mode 100644 index 000000000..4489f6886 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterface.java @@ -0,0 +1,716 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines additional transport information for the agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentInterface} + */ +@com.google.protobuf.Generated +public final class AgentInterface extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentInterface) + AgentInterfaceOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentInterface"); + } + // Use AgentInterface.newBuilder() to construct. + private AgentInterface(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentInterface() { + url_ = ""; + transport_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentInterface_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentInterface.class, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder.class); + } + + public static final int URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TRANSPORT_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object transport_ = ""; + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The transport. + */ + @java.lang.Override + public java.lang.String getTransport() { + java.lang.Object ref = transport_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transport_ = s; + return s; + } + } + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTransportBytes() { + java.lang.Object ref = transport_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(transport_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, transport_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(transport_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, transport_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentInterface)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentInterface other = (org.a2aproject.sdk.compat03.grpc.AgentInterface) obj; + + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getTransport() + .equals(other.getTransport())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + TRANSPORT_FIELD_NUMBER; + hash = (53 * hash) + getTransport().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentInterface parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentInterface prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines additional transport information for the agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentInterface} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentInterface) + org.a2aproject.sdk.compat03.grpc.AgentInterfaceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentInterface_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentInterface.class, org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentInterface.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + url_ = ""; + transport_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentInterface_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface build() { + org.a2aproject.sdk.compat03.grpc.AgentInterface result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentInterface result = new org.a2aproject.sdk.compat03.grpc.AgentInterface(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentInterface result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.transport_ = transport_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentInterface) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentInterface)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentInterface other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentInterface.getDefaultInstance()) return this; + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTransport().isEmpty()) { + transport_ = other.transport_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + transport_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object url_ = ""; + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The url this interface is found at.
+     * 
+ * + * string url = 1; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object transport_ = ""; + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return The transport. + */ + public java.lang.String getTransport() { + java.lang.Object ref = transport_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + transport_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + public com.google.protobuf.ByteString + getTransportBytes() { + java.lang.Object ref = transport_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + transport_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @param value The transport to set. + * @return This builder for chaining. + */ + public Builder setTransport( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + transport_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @return This builder for chaining. + */ + public Builder clearTransport() { + transport_ = getDefaultInstance().getTransport(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The transport supported this url. This is an open form string, to be
+     * easily extended for many transport protocols. The core ones officially
+     * supported are JSONRPC, GRPC and HTTP+JSON.
+     * 
+ * + * string transport = 2; + * @param value The bytes for transport to set. + * @return This builder for chaining. + */ + public Builder setTransportBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + transport_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentInterface) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentInterface) + private static final org.a2aproject.sdk.compat03.grpc.AgentInterface DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentInterface(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentInterface parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentInterface getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java new file mode 100644 index 000000000..261794711 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentInterfaceOrBuilder.java @@ -0,0 +1,56 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentInterfaceOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentInterface) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * The url this interface is found at.
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The transport. + */ + java.lang.String getTransport(); + /** + *
+   * The transport supported this url. This is an open form string, to be
+   * easily extended for many transport protocols. The core ones officially
+   * supported are JSONRPC, GRPC and HTTP+JSON.
+   * 
+ * + * string transport = 2; + * @return The bytes for transport. + */ + com.google.protobuf.ByteString + getTransportBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java new file mode 100644 index 000000000..8149d9701 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProvider.java @@ -0,0 +1,716 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Represents information about the service provider of an agent.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentProvider} + */ +@com.google.protobuf.Generated +public final class AgentProvider extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentProvider) + AgentProviderOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentProvider"); + } + // Use AgentProvider.newBuilder() to construct. + private AgentProvider(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentProvider() { + url_ = ""; + organization_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentProvider_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentProvider.class, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder.class); + } + + public static final int URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ORGANIZATION_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object organization_ = ""; + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The organization. + */ + @java.lang.Override + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } + } + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(organization_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, organization_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(organization_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, organization_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentProvider)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentProvider other = (org.a2aproject.sdk.compat03.grpc.AgentProvider) obj; + + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getOrganization() + .equals(other.getOrganization())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + ORGANIZATION_FIELD_NUMBER; + hash = (53 * hash) + getOrganization().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentProvider parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentProvider prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Represents information about the service provider of an agent.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentProvider} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentProvider) + org.a2aproject.sdk.compat03.grpc.AgentProviderOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentProvider_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentProvider.class, org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentProvider.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + url_ = ""; + organization_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentProvider_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider build() { + org.a2aproject.sdk.compat03.grpc.AgentProvider result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentProvider result = new org.a2aproject.sdk.compat03.grpc.AgentProvider(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentProvider result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.organization_ = organization_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentProvider) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentProvider)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentProvider other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentProvider.getDefaultInstance()) return this; + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getOrganization().isEmpty()) { + organization_ = other.organization_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + organization_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object url_ = ""; + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The providers reference url
+     * Example: "https://ai.google.dev"
+     * 
+ * + * string url = 1; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object organization_ = ""; + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return The organization. + */ + public java.lang.String getOrganization() { + java.lang.Object ref = organization_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + organization_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + public com.google.protobuf.ByteString + getOrganizationBytes() { + java.lang.Object ref = organization_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + organization_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @param value The organization to set. + * @return This builder for chaining. + */ + public Builder setOrganization( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + organization_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @return This builder for chaining. + */ + public Builder clearOrganization() { + organization_ = getDefaultInstance().getOrganization(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The providers organization name
+     * Example: "Google"
+     * 
+ * + * string organization = 2; + * @param value The bytes for organization to set. + * @return This builder for chaining. + */ + public Builder setOrganizationBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + organization_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentProvider) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentProvider) + private static final org.a2aproject.sdk.compat03.grpc.AgentProvider DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentProvider(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentProvider parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentProvider getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java new file mode 100644 index 000000000..7335191a6 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentProviderOrBuilder.java @@ -0,0 +1,56 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentProviderOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentProvider) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * The providers reference url
+   * Example: "https://ai.google.dev"
+   * 
+ * + * string url = 1; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The organization. + */ + java.lang.String getOrganization(); + /** + *
+   * The providers organization name
+   * Example: "Google"
+   * 
+ * + * string organization = 2; + * @return The bytes for organization. + */ + com.google.protobuf.ByteString + getOrganizationBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java new file mode 100644 index 000000000..152812e4e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkill.java @@ -0,0 +1,2435 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * AgentSkill represents a unit of action/solution that the agent can perform.
+ * One can think of this as a type of highly reliable solution that an agent
+ * can be tasked to provide. Agents have the autonomy to choose how and when
+ * to use specific skills, but clients should have confidence that if the
+ * skill is defined that unit of action can be reliably performed.
+ * 
+ * + * Protobuf type {@code a2a.v1.AgentSkill} + */ +@com.google.protobuf.Generated +public final class AgentSkill extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AgentSkill) + AgentSkillOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AgentSkill"); + } + // Use AgentSkill.newBuilder() to construct. + private AgentSkill(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AgentSkill() { + id_ = ""; + name_ = ""; + description_ = ""; + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + security_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentSkill_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentSkill.class, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder.class); + } + + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TAGS_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList + getTagsList() { + return tags_; + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString + getTagsBytes(int index) { + return tags_.getByteString(index); + } + + public static final int EXAMPLES_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + public com.google.protobuf.ProtocolStringList + getExamplesList() { + return examples_; + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + public int getExamplesCount() { + return examples_.size(); + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + public java.lang.String getExamples(int index) { + return examples_.get(index); + } + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + public com.google.protobuf.ByteString + getExamplesBytes(int index) { + return examples_.getByteString(index); + } + + public static final int INPUT_MODES_FIELD_NUMBER = 6; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + public com.google.protobuf.ProtocolStringList + getInputModesList() { + return inputModes_; + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + public int getInputModesCount() { + return inputModes_.size(); + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + public java.lang.String getInputModes(int index) { + return inputModes_.get(index); + } + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + public com.google.protobuf.ByteString + getInputModesBytes(int index) { + return inputModes_.getByteString(index); + } + + public static final int OUTPUT_MODES_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + public com.google.protobuf.ProtocolStringList + getOutputModesList() { + return outputModes_; + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + public int getOutputModesCount() { + return outputModes_.size(); + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + public java.lang.String getOutputModes(int index) { + return outputModes_.get(index); + } + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + public com.google.protobuf.ByteString + getOutputModesBytes(int index) { + return outputModes_.getByteString(index); + } + + public static final int SECURITY_FIELD_NUMBER = 8; + @SuppressWarnings("serial") + private java.util.List security_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public java.util.List getSecurityList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public java.util.List + getSecurityOrBuilderList() { + return security_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public int getSecurityCount() { + return security_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + return security_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + return security_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, description_); + } + for (int i = 0; i < tags_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, tags_.getRaw(i)); + } + for (int i = 0; i < examples_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 5, examples_.getRaw(i)); + } + for (int i = 0; i < inputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 6, inputModes_.getRaw(i)); + } + for (int i = 0; i < outputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, outputModes_.getRaw(i)); + } + for (int i = 0; i < security_.size(); i++) { + output.writeMessage(8, security_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, description_); + } + { + int dataSize = 0; + for (int i = 0; i < tags_.size(); i++) { + dataSize += computeStringSizeNoTag(tags_.getRaw(i)); + } + size += dataSize; + size += 1 * getTagsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < examples_.size(); i++) { + dataSize += computeStringSizeNoTag(examples_.getRaw(i)); + } + size += dataSize; + size += 1 * getExamplesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < inputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(inputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getInputModesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < outputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(outputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getOutputModesList().size(); + } + for (int i = 0; i < security_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, security_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AgentSkill)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AgentSkill other = (org.a2aproject.sdk.compat03.grpc.AgentSkill) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getTagsList() + .equals(other.getTagsList())) return false; + if (!getExamplesList() + .equals(other.getExamplesList())) return false; + if (!getInputModesList() + .equals(other.getInputModesList())) return false; + if (!getOutputModesList() + .equals(other.getOutputModesList())) return false; + if (!getSecurityList() + .equals(other.getSecurityList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (getTagsCount() > 0) { + hash = (37 * hash) + TAGS_FIELD_NUMBER; + hash = (53 * hash) + getTagsList().hashCode(); + } + if (getExamplesCount() > 0) { + hash = (37 * hash) + EXAMPLES_FIELD_NUMBER; + hash = (53 * hash) + getExamplesList().hashCode(); + } + if (getInputModesCount() > 0) { + hash = (37 * hash) + INPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getInputModesList().hashCode(); + } + if (getOutputModesCount() > 0) { + hash = (37 * hash) + OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getOutputModesList().hashCode(); + } + if (getSecurityCount() > 0) { + hash = (37 * hash) + SECURITY_FIELD_NUMBER; + hash = (53 * hash) + getSecurityList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AgentSkill parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AgentSkill prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * AgentSkill represents a unit of action/solution that the agent can perform.
+   * One can think of this as a type of highly reliable solution that an agent
+   * can be tasked to provide. Agents have the autonomy to choose how and when
+   * to use specific skills, but clients should have confidence that if the
+   * skill is defined that unit of action can be reliably performed.
+   * 
+ * + * Protobuf type {@code a2a.v1.AgentSkill} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AgentSkill) + org.a2aproject.sdk.compat03.grpc.AgentSkillOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentSkill_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AgentSkill.class, org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AgentSkill.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + name_ = ""; + description_ = ""; + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + } else { + security_ = null; + securityBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000080); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AgentSkill_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill build() { + org.a2aproject.sdk.compat03.grpc.AgentSkill result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill buildPartial() { + org.a2aproject.sdk.compat03.grpc.AgentSkill result = new org.a2aproject.sdk.compat03.grpc.AgentSkill(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.AgentSkill result) { + if (securityBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0)) { + security_ = java.util.Collections.unmodifiableList(security_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.security_ = security_; + } else { + result.security_ = securityBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AgentSkill result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + tags_.makeImmutable(); + result.tags_ = tags_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + examples_.makeImmutable(); + result.examples_ = examples_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + inputModes_.makeImmutable(); + result.inputModes_ = inputModes_; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + outputModes_.makeImmutable(); + result.outputModes_ = outputModes_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AgentSkill) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AgentSkill)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AgentSkill other) { + if (other == org.a2aproject.sdk.compat03.grpc.AgentSkill.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (!other.tags_.isEmpty()) { + if (tags_.isEmpty()) { + tags_ = other.tags_; + bitField0_ |= 0x00000008; + } else { + ensureTagsIsMutable(); + tags_.addAll(other.tags_); + } + onChanged(); + } + if (!other.examples_.isEmpty()) { + if (examples_.isEmpty()) { + examples_ = other.examples_; + bitField0_ |= 0x00000010; + } else { + ensureExamplesIsMutable(); + examples_.addAll(other.examples_); + } + onChanged(); + } + if (!other.inputModes_.isEmpty()) { + if (inputModes_.isEmpty()) { + inputModes_ = other.inputModes_; + bitField0_ |= 0x00000020; + } else { + ensureInputModesIsMutable(); + inputModes_.addAll(other.inputModes_); + } + onChanged(); + } + if (!other.outputModes_.isEmpty()) { + if (outputModes_.isEmpty()) { + outputModes_ = other.outputModes_; + bitField0_ |= 0x00000040; + } else { + ensureOutputModesIsMutable(); + outputModes_.addAll(other.outputModes_); + } + onChanged(); + } + if (securityBuilder_ == null) { + if (!other.security_.isEmpty()) { + if (security_.isEmpty()) { + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureSecurityIsMutable(); + security_.addAll(other.security_); + } + onChanged(); + } + } else { + if (!other.security_.isEmpty()) { + if (securityBuilder_.isEmpty()) { + securityBuilder_.dispose(); + securityBuilder_ = null; + security_ = other.security_; + bitField0_ = (bitField0_ & ~0x00000080); + securityBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetSecurityFieldBuilder() : null; + } else { + securityBuilder_.addAllMessages(other.security_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + ensureTagsIsMutable(); + tags_.add(s); + break; + } // case 34 + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExamplesIsMutable(); + examples_.add(s); + break; + } // case 42 + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + ensureInputModesIsMutable(); + inputModes_.add(s); + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureOutputModesIsMutable(); + outputModes_.add(s); + break; + } // case 58 + case 66: { + org.a2aproject.sdk.compat03.grpc.Security m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Security.parser(), + extensionRegistry); + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(m); + } else { + securityBuilder_.addMessage(m); + } + break; + } // case 66 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique id of the skill within this agent.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the skill.
+     * 
+ * + * string name = 2; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A human (or llm) readable description of the skill
+     * details and behaviors.
+     * 
+ * + * string description = 3; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureTagsIsMutable() { + if (!tags_.isModifiable()) { + tags_ = new com.google.protobuf.LazyStringArrayList(tags_); + } + bitField0_ |= 0x00000008; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + public com.google.protobuf.ProtocolStringList + getTagsList() { + tags_.makeImmutable(); + return tags_; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + public int getTagsCount() { + return tags_.size(); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + public java.lang.String getTags(int index) { + return tags_.get(index); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + public com.google.protobuf.ByteString + getTagsBytes(int index) { + return tags_.getByteString(index); + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param index The index to set the value at. + * @param value The tags to set. + * @return This builder for chaining. + */ + public Builder setTags( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureTagsIsMutable(); + tags_.set(index, value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param value The tags to add. + * @return This builder for chaining. + */ + public Builder addTags( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureTagsIsMutable(); + tags_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param values The tags to add. + * @return This builder for chaining. + */ + public Builder addAllTags( + java.lang.Iterable values) { + ensureTagsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, tags_); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @return This builder for chaining. + */ + public Builder clearTags() { + tags_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008);; + onChanged(); + return this; + } + /** + *
+     * A set of tags for the skill to enhance categorization/utilization.
+     * Example: ["cooking", "customer support", "billing"]
+     * 
+ * + * repeated string tags = 4; + * @param value The bytes of the tags to add. + * @return This builder for chaining. + */ + public Builder addTagsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureTagsIsMutable(); + tags_.add(value); + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExamplesIsMutable() { + if (!examples_.isModifiable()) { + examples_ = new com.google.protobuf.LazyStringArrayList(examples_); + } + bitField0_ |= 0x00000010; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + public com.google.protobuf.ProtocolStringList + getExamplesList() { + examples_.makeImmutable(); + return examples_; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + public int getExamplesCount() { + return examples_.size(); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + public java.lang.String getExamples(int index) { + return examples_.get(index); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + public com.google.protobuf.ByteString + getExamplesBytes(int index) { + return examples_.getByteString(index); + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param index The index to set the value at. + * @param value The examples to set. + * @return This builder for chaining. + */ + public Builder setExamples( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExamplesIsMutable(); + examples_.set(index, value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param value The examples to add. + * @return This builder for chaining. + */ + public Builder addExamples( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExamplesIsMutable(); + examples_.add(value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param values The examples to add. + * @return This builder for chaining. + */ + public Builder addAllExamples( + java.lang.Iterable values) { + ensureExamplesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, examples_); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @return This builder for chaining. + */ + public Builder clearExamples() { + examples_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010);; + onChanged(); + return this; + } + /** + *
+     * A set of example queries that this skill is designed to address.
+     * These examples should help the caller to understand how to craft requests
+     * to the agent to achieve specific goals.
+     * Example: ["I need a recipe for bread"]
+     * 
+ * + * repeated string examples = 5; + * @param value The bytes of the examples to add. + * @return This builder for chaining. + */ + public Builder addExamplesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExamplesIsMutable(); + examples_.add(value); + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureInputModesIsMutable() { + if (!inputModes_.isModifiable()) { + inputModes_ = new com.google.protobuf.LazyStringArrayList(inputModes_); + } + bitField0_ |= 0x00000020; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + public com.google.protobuf.ProtocolStringList + getInputModesList() { + inputModes_.makeImmutable(); + return inputModes_; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + public int getInputModesCount() { + return inputModes_.size(); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + public java.lang.String getInputModes(int index) { + return inputModes_.get(index); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + public com.google.protobuf.ByteString + getInputModesBytes(int index) { + return inputModes_.getByteString(index); + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param index The index to set the value at. + * @param value The inputModes to set. + * @return This builder for chaining. + */ + public Builder setInputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureInputModesIsMutable(); + inputModes_.set(index, value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param value The inputModes to add. + * @return This builder for chaining. + */ + public Builder addInputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureInputModesIsMutable(); + inputModes_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param values The inputModes to add. + * @return This builder for chaining. + */ + public Builder addAllInputModes( + java.lang.Iterable values) { + ensureInputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, inputModes_); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @return This builder for chaining. + */ + public Builder clearInputModes() { + inputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020);; + onChanged(); + return this; + } + /** + *
+     * Possible input modalities supported.
+     * 
+ * + * repeated string input_modes = 6; + * @param value The bytes of the inputModes to add. + * @return This builder for chaining. + */ + public Builder addInputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureInputModesIsMutable(); + inputModes_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureOutputModesIsMutable() { + if (!outputModes_.isModifiable()) { + outputModes_ = new com.google.protobuf.LazyStringArrayList(outputModes_); + } + bitField0_ |= 0x00000040; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + public com.google.protobuf.ProtocolStringList + getOutputModesList() { + outputModes_.makeImmutable(); + return outputModes_; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + public int getOutputModesCount() { + return outputModes_.size(); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + public java.lang.String getOutputModes(int index) { + return outputModes_.get(index); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + public com.google.protobuf.ByteString + getOutputModesBytes(int index) { + return outputModes_.getByteString(index); + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param index The index to set the value at. + * @param value The outputModes to set. + * @return This builder for chaining. + */ + public Builder setOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureOutputModesIsMutable(); + outputModes_.set(index, value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param value The outputModes to add. + * @return This builder for chaining. + */ + public Builder addOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureOutputModesIsMutable(); + outputModes_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param values The outputModes to add. + * @return This builder for chaining. + */ + public Builder addAllOutputModes( + java.lang.Iterable values) { + ensureOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, outputModes_); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @return This builder for chaining. + */ + public Builder clearOutputModes() { + outputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040);; + onChanged(); + return this; + } + /** + *
+     * Possible output modalities produced
+     * 
+ * + * repeated string output_modes = 7; + * @param value The bytes of the outputModes to add. + * @return This builder for chaining. + */ + public Builder addOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureOutputModesIsMutable(); + outputModes_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + private java.util.List security_ = + java.util.Collections.emptyList(); + private void ensureSecurityIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + security_ = new java.util.ArrayList(security_); + bitField0_ |= 0x00000080; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> securityBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List getSecurityList() { + if (securityBuilder_ == null) { + return java.util.Collections.unmodifiableList(security_); + } else { + return securityBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public int getSecurityCount() { + if (securityBuilder_ == null) { + return security_.size(); + } else { + return securityBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index) { + if (securityBuilder_ == null) { + return security_.get(index); + } else { + return securityBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.set(index, value); + onChanged(); + } else { + securityBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder setSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.set(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity(org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(value); + onChanged(); + } else { + securityBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security value) { + if (securityBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSecurityIsMutable(); + security_.add(index, value); + onChanged(); + } else { + securityBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addSecurity( + int index, org.a2aproject.sdk.compat03.grpc.Security.Builder builderForValue) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.add(index, builderForValue.build()); + onChanged(); + } else { + securityBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder addAllSecurity( + java.lang.Iterable values) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, security_); + onChanged(); + } else { + securityBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder clearSecurity() { + if (securityBuilder_ == null) { + security_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + } else { + securityBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public Builder removeSecurity(int index) { + if (securityBuilder_ == null) { + ensureSecurityIsMutable(); + security_.remove(index); + onChanged(); + } else { + securityBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder getSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index) { + if (securityBuilder_ == null) { + return security_.get(index); } else { + return securityBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List + getSecurityOrBuilderList() { + if (securityBuilder_ != null) { + return securityBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(security_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder() { + return internalGetSecurityFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public org.a2aproject.sdk.compat03.grpc.Security.Builder addSecurityBuilder( + int index) { + return internalGetSecurityFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Security schemes necessary for the agent to leverage this skill.
+     * As in the overall AgentCard.security, this list represents a logical OR of
+     * security requirement objects. Each object is a set of security schemes
+     * that must be used together (a logical AND).
+     * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + public java.util.List + getSecurityBuilderList() { + return internalGetSecurityFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder> + internalGetSecurityFieldBuilder() { + if (securityBuilder_ == null) { + securityBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Security, org.a2aproject.sdk.compat03.grpc.Security.Builder, org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder>( + security_, + ((bitField0_ & 0x00000080) != 0), + getParentForChildren(), + isClean()); + security_ = null; + } + return securityBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AgentSkill) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AgentSkill) + private static final org.a2aproject.sdk.compat03.grpc.AgentSkill DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AgentSkill(); + } + + public static org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AgentSkill parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AgentSkill getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java new file mode 100644 index 000000000..0a61179db --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AgentSkillOrBuilder.java @@ -0,0 +1,318 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AgentSkillOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AgentSkill) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * Unique id of the skill within this agent.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the skill.
+   * 
+ * + * string name = 2; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A human (or llm) readable description of the skill
+   * details and behaviors.
+   * 
+ * + * string description = 3; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return A list containing the tags. + */ + java.util.List + getTagsList(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @return The count of tags. + */ + int getTagsCount(); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the element to return. + * @return The tags at the given index. + */ + java.lang.String getTags(int index); + /** + *
+   * A set of tags for the skill to enhance categorization/utilization.
+   * Example: ["cooking", "customer support", "billing"]
+   * 
+ * + * repeated string tags = 4; + * @param index The index of the value to return. + * @return The bytes of the tags at the given index. + */ + com.google.protobuf.ByteString + getTagsBytes(int index); + + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return A list containing the examples. + */ + java.util.List + getExamplesList(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @return The count of examples. + */ + int getExamplesCount(); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the element to return. + * @return The examples at the given index. + */ + java.lang.String getExamples(int index); + /** + *
+   * A set of example queries that this skill is designed to address.
+   * These examples should help the caller to understand how to craft requests
+   * to the agent to achieve specific goals.
+   * Example: ["I need a recipe for bread"]
+   * 
+ * + * repeated string examples = 5; + * @param index The index of the value to return. + * @return The bytes of the examples at the given index. + */ + com.google.protobuf.ByteString + getExamplesBytes(int index); + + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return A list containing the inputModes. + */ + java.util.List + getInputModesList(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @return The count of inputModes. + */ + int getInputModesCount(); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the element to return. + * @return The inputModes at the given index. + */ + java.lang.String getInputModes(int index); + /** + *
+   * Possible input modalities supported.
+   * 
+ * + * repeated string input_modes = 6; + * @param index The index of the value to return. + * @return The bytes of the inputModes at the given index. + */ + com.google.protobuf.ByteString + getInputModesBytes(int index); + + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return A list containing the outputModes. + */ + java.util.List + getOutputModesList(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @return The count of outputModes. + */ + int getOutputModesCount(); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the element to return. + * @return The outputModes at the given index. + */ + java.lang.String getOutputModes(int index); + /** + *
+   * Possible output modalities produced
+   * 
+ * + * repeated string output_modes = 7; + * @param index The index of the value to return. + * @return The bytes of the outputModes at the given index. + */ + com.google.protobuf.ByteString + getOutputModesBytes(int index); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + java.util.List + getSecurityList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + org.a2aproject.sdk.compat03.grpc.Security getSecurity(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + int getSecurityCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + java.util.List + getSecurityOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Security schemes necessary for the agent to leverage this skill.
+   * As in the overall AgentCard.security, this list represents a logical OR of
+   * security requirement objects. Each object is a set of security schemes
+   * that must be used together (a logical AND).
+   * 
+ * + * repeated .a2a.v1.Security security = 8; + */ + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder getSecurityOrBuilder( + int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java new file mode 100644 index 000000000..e23d4cdec --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Artifact.java @@ -0,0 +1,1799 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Artifacts are the container for task completed results. These are similar
+ * to Messages but are intended to be the product of a task, as opposed to
+ * point-to-point communication.
+ * 
+ * + * Protobuf type {@code a2a.v1.Artifact} + */ +@com.google.protobuf.Generated +public final class Artifact extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Artifact) + ArtifactOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Artifact"); + } + // Use Artifact.newBuilder() to construct. + private Artifact(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Artifact() { + artifactId_ = ""; + name_ = ""; + description_ = ""; + parts_ = java.util.Collections.emptyList(); + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Artifact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Artifact.class, org.a2aproject.sdk.compat03.grpc.Artifact.Builder.class); + } + + private int bitField0_; + public static final int ARTIFACT_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object artifactId_ = ""; + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + @java.lang.Override + public java.lang.String getArtifactId() { + java.lang.Object ref = artifactId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + artifactId_ = s; + return s; + } + } + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getArtifactIdBytes() { + java.lang.Object ref = artifactId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + artifactId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PARTS_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List parts_; + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public java.util.List getPartsList() { + return parts_; + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public java.util.List + getPartsOrBuilderList() { + return parts_; + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public int getPartsCount() { + return parts_.size(); + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getParts(int index) { + return parts_.get(index); + } + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index) { + return parts_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + return extensions_; + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(artifactId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, artifactId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 4, description_); + } + for (int i = 0; i < parts_.size(); i++) { + output.writeMessage(5, parts_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMetadata()); + } + for (int i = 0; i < extensions_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, extensions_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(artifactId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, artifactId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, name_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(4, description_); + } + for (int i = 0; i < parts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, parts_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + { + int dataSize = 0; + for (int i = 0; i < extensions_.size(); i++) { + dataSize += computeStringSizeNoTag(extensions_.getRaw(i)); + } + size += dataSize; + size += 1 * getExtensionsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Artifact)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Artifact other = (org.a2aproject.sdk.compat03.grpc.Artifact) obj; + + if (!getArtifactId() + .equals(other.getArtifactId())) return false; + if (!getName() + .equals(other.getName())) return false; + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getPartsList() + .equals(other.getPartsList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ARTIFACT_ID_FIELD_NUMBER; + hash = (53 * hash) + getArtifactId().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (getPartsCount() > 0) { + hash = (37 * hash) + PARTS_FIELD_NUMBER; + hash = (53 * hash) + getPartsList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Artifact parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Artifact prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Artifacts are the container for task completed results. These are similar
+   * to Messages but are intended to be the product of a task, as opposed to
+   * point-to-point communication.
+   * 
+ * + * Protobuf type {@code a2a.v1.Artifact} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Artifact) + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Artifact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Artifact.class, org.a2aproject.sdk.compat03.grpc.Artifact.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Artifact.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPartsFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + artifactId_ = ""; + name_ = ""; + description_ = ""; + if (partsBuilder_ == null) { + parts_ = java.util.Collections.emptyList(); + } else { + parts_ = null; + partsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Artifact_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact build() { + org.a2aproject.sdk.compat03.grpc.Artifact result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact buildPartial() { + org.a2aproject.sdk.compat03.grpc.Artifact result = new org.a2aproject.sdk.compat03.grpc.Artifact(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Artifact result) { + if (partsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + parts_ = java.util.Collections.unmodifiableList(parts_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.parts_ = parts_; + } else { + result.parts_ = partsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Artifact result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.artifactId_ = artifactId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.description_ = description_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000010) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + extensions_.makeImmutable(); + result.extensions_ = extensions_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Artifact) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Artifact)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Artifact other) { + if (other == org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()) return this; + if (!other.getArtifactId().isEmpty()) { + artifactId_ = other.artifactId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (partsBuilder_ == null) { + if (!other.parts_.isEmpty()) { + if (parts_.isEmpty()) { + parts_ = other.parts_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensurePartsIsMutable(); + parts_.addAll(other.parts_); + } + onChanged(); + } + } else { + if (!other.parts_.isEmpty()) { + if (partsBuilder_.isEmpty()) { + partsBuilder_.dispose(); + partsBuilder_ = null; + parts_ = other.parts_; + bitField0_ = (bitField0_ & ~0x00000008); + partsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetPartsFieldBuilder() : null; + } else { + partsBuilder_.addAllMessages(other.parts_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ |= 0x00000020; + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + artifactId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 26: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 26 + case 34: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 34 + case 42: { + org.a2aproject.sdk.compat03.grpc.Part m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Part.parser(), + extensionRegistry); + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(m); + } else { + partsBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExtensionsIsMutable(); + extensions_.add(s); + break; + } // case 58 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object artifactId_ = ""; + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + public java.lang.String getArtifactId() { + java.lang.Object ref = artifactId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + artifactId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + public com.google.protobuf.ByteString + getArtifactIdBytes() { + java.lang.Object ref = artifactId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + artifactId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @param value The artifactId to set. + * @return This builder for chaining. + */ + public Builder setArtifactId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + artifactId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @return This builder for chaining. + */ + public Builder clearArtifactId() { + artifactId_ = getDefaultInstance().getArtifactId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique id for the artifact. It must be at least unique within a task.
+     * 
+ * + * string artifact_id = 1; + * @param value The bytes for artifactId to set. + * @return This builder for chaining. + */ + public Builder setArtifactIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + artifactId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A human readable name for the artifact.
+     * 
+ * + * string name = 3; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A human readable description of the artifact, optional.
+     * 
+ * + * string description = 4; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private java.util.List parts_ = + java.util.Collections.emptyList(); + private void ensurePartsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + parts_ = new java.util.ArrayList(parts_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> partsBuilder_; + + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List getPartsList() { + if (partsBuilder_ == null) { + return java.util.Collections.unmodifiableList(parts_); + } else { + return partsBuilder_.getMessageList(); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public int getPartsCount() { + if (partsBuilder_ == null) { + return parts_.size(); + } else { + return partsBuilder_.getCount(); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part getParts(int index) { + if (partsBuilder_ == null) { + return parts_.get(index); + } else { + return partsBuilder_.getMessage(index); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder setParts( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.set(index, value); + onChanged(); + } else { + partsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder setParts( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.set(index, builderForValue.build()); + onChanged(); + } else { + partsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts(org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.add(value); + onChanged(); + } else { + partsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (partsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePartsIsMutable(); + parts_.add(index, value); + onChanged(); + } else { + partsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(builderForValue.build()); + onChanged(); + } else { + partsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addParts( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.add(index, builderForValue.build()); + onChanged(); + } else { + partsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder addAllParts( + java.lang.Iterable values) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, parts_); + onChanged(); + } else { + partsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder clearParts() { + if (partsBuilder_ == null) { + parts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + partsBuilder_.clear(); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public Builder removeParts(int index) { + if (partsBuilder_ == null) { + ensurePartsIsMutable(); + parts_.remove(index); + onChanged(); + } else { + partsBuilder_.remove(index); + } + return this; + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder getPartsBuilder( + int index) { + return internalGetPartsFieldBuilder().getBuilder(index); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index) { + if (partsBuilder_ == null) { + return parts_.get(index); } else { + return partsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List + getPartsOrBuilderList() { + if (partsBuilder_ != null) { + return partsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(parts_); + } + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addPartsBuilder() { + return internalGetPartsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addPartsBuilder( + int index) { + return internalGetPartsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * The content of the artifact.
+     * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + public java.util.List + getPartsBuilderList() { + return internalGetPartsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> + internalGetPartsFieldBuilder() { + if (partsBuilder_ == null) { + partsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder>( + parts_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + parts_ = null; + } + return partsBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata included with the artifact.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExtensionsIsMutable() { + if (!extensions_.isModifiable()) { + extensions_ = new com.google.protobuf.LazyStringArrayList(extensions_); + } + bitField0_ |= 0x00000020; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + extensions_.makeImmutable(); + return extensions_; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index to set the value at. + * @param value The extensions to set. + * @return This builder for chaining. + */ + public Builder setExtensions( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param value The extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensions( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param values The extensions to add. + * @return This builder for chaining. + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @return This builder for chaining. + */ + public Builder clearExtensions() { + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020);; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Artifact.
+     * 
+ * + * repeated string extensions = 7; + * @param value The bytes of the extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensionsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Artifact) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Artifact) + private static final org.a2aproject.sdk.compat03.grpc.Artifact DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Artifact(); + } + + public static org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Artifact parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java new file mode 100644 index 000000000..eeedc6acd --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ArtifactOrBuilder.java @@ -0,0 +1,184 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ArtifactOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Artifact) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The artifactId. + */ + java.lang.String getArtifactId(); + /** + *
+   * Unique id for the artifact. It must be at least unique within a task.
+   * 
+ * + * string artifact_id = 1; + * @return The bytes for artifactId. + */ + com.google.protobuf.ByteString + getArtifactIdBytes(); + + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * A human readable name for the artifact.
+   * 
+ * + * string name = 3; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * A human readable description of the artifact, optional.
+   * 
+ * + * string description = 4; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + java.util.List + getPartsList(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + org.a2aproject.sdk.compat03.grpc.Part getParts(int index); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + int getPartsCount(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + java.util.List + getPartsOrBuilderList(); + /** + *
+   * The content of the artifact.
+   * 
+ * + * repeated .a2a.v1.Part parts = 5; + */ + org.a2aproject.sdk.compat03.grpc.PartOrBuilder getPartsOrBuilder( + int index); + + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata included with the artifact.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); + + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + java.util.List + getExtensionsList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + int getExtensionsCount(); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + java.lang.String getExtensions(int index); + /** + *
+   * The URIs of extensions that are present or contributed to this Artifact.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + com.google.protobuf.ByteString + getExtensionsBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java new file mode 100644 index 000000000..14da2c3cf --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfo.java @@ -0,0 +1,779 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Defines authentication details, used for push notifications.
+ * 
+ * + * Protobuf type {@code a2a.v1.AuthenticationInfo} + */ +@com.google.protobuf.Generated +public final class AuthenticationInfo extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AuthenticationInfo) + AuthenticationInfoOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AuthenticationInfo"); + } + // Use AuthenticationInfo.newBuilder() to construct. + private AuthenticationInfo(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AuthenticationInfo() { + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + credentials_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.class, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder.class); + } + + public static final int SCHEMES_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + public com.google.protobuf.ProtocolStringList + getSchemesList() { + return schemes_; + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + public int getSchemesCount() { + return schemes_.size(); + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + public java.lang.String getSchemes(int index) { + return schemes_.get(index); + } + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + public com.google.protobuf.ByteString + getSchemesBytes(int index) { + return schemes_.getByteString(index); + } + + public static final int CREDENTIALS_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object credentials_ = ""; + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The credentials. + */ + @java.lang.Override + public java.lang.String getCredentials() { + java.lang.Object ref = credentials_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + credentials_ = s; + return s; + } + } + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getCredentialsBytes() { + java.lang.Object ref = credentials_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + credentials_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < schemes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, schemes_.getRaw(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(credentials_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, credentials_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < schemes_.size(); i++) { + dataSize += computeStringSizeNoTag(schemes_.getRaw(i)); + } + size += dataSize; + size += 1 * getSchemesList().size(); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(credentials_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, credentials_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AuthenticationInfo)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo other = (org.a2aproject.sdk.compat03.grpc.AuthenticationInfo) obj; + + if (!getSchemesList() + .equals(other.getSchemesList())) return false; + if (!getCredentials() + .equals(other.getCredentials())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSchemesCount() > 0) { + hash = (37 * hash) + SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + getSchemesList().hashCode(); + } + hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER; + hash = (53 * hash) + getCredentials().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Defines authentication details, used for push notifications.
+   * 
+ * + * Protobuf type {@code a2a.v1.AuthenticationInfo} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AuthenticationInfo) + org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthenticationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.class, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + credentials_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthenticationInfo_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo build() { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo buildPartial() { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result = new org.a2aproject.sdk.compat03.grpc.AuthenticationInfo(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + schemes_.makeImmutable(); + result.schemes_ = schemes_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.credentials_ = credentials_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AuthenticationInfo) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AuthenticationInfo)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo other) { + if (other == org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance()) return this; + if (!other.schemes_.isEmpty()) { + if (schemes_.isEmpty()) { + schemes_ = other.schemes_; + bitField0_ |= 0x00000001; + } else { + ensureSchemesIsMutable(); + schemes_.addAll(other.schemes_); + } + onChanged(); + } + if (!other.getCredentials().isEmpty()) { + credentials_ = other.credentials_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureSchemesIsMutable(); + schemes_.add(s); + break; + } // case 10 + case 18: { + credentials_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureSchemesIsMutable() { + if (!schemes_.isModifiable()) { + schemes_ = new com.google.protobuf.LazyStringArrayList(schemes_); + } + bitField0_ |= 0x00000001; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + public com.google.protobuf.ProtocolStringList + getSchemesList() { + schemes_.makeImmutable(); + return schemes_; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + public int getSchemesCount() { + return schemes_.size(); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + public java.lang.String getSchemes(int index) { + return schemes_.get(index); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + public com.google.protobuf.ByteString + getSchemesBytes(int index) { + return schemes_.getByteString(index); + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param index The index to set the value at. + * @param value The schemes to set. + * @return This builder for chaining. + */ + public Builder setSchemes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureSchemesIsMutable(); + schemes_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param value The schemes to add. + * @return This builder for chaining. + */ + public Builder addSchemes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureSchemesIsMutable(); + schemes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param values The schemes to add. + * @return This builder for chaining. + */ + public Builder addAllSchemes( + java.lang.Iterable values) { + ensureSchemesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, schemes_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @return This builder for chaining. + */ + public Builder clearSchemes() { + schemes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + *
+     * Supported authentication schemes - e.g. Basic, Bearer, etc
+     * 
+ * + * repeated string schemes = 1; + * @param value The bytes of the schemes to add. + * @return This builder for chaining. + */ + public Builder addSchemesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureSchemesIsMutable(); + schemes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object credentials_ = ""; + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return The credentials. + */ + public java.lang.String getCredentials() { + java.lang.Object ref = credentials_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + credentials_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + public com.google.protobuf.ByteString + getCredentialsBytes() { + java.lang.Object ref = credentials_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + credentials_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @param value The credentials to set. + * @return This builder for chaining. + */ + public Builder setCredentials( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + credentials_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @return This builder for chaining. + */ + public Builder clearCredentials() { + credentials_ = getDefaultInstance().getCredentials(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Optional credentials
+     * 
+ * + * string credentials = 2; + * @param value The bytes for credentials to set. + * @return This builder for chaining. + */ + public Builder setCredentialsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + credentials_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AuthenticationInfo) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AuthenticationInfo) + private static final org.a2aproject.sdk.compat03.grpc.AuthenticationInfo DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AuthenticationInfo(); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AuthenticationInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java new file mode 100644 index 000000000..6b25b7358 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthenticationInfoOrBuilder.java @@ -0,0 +1,73 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AuthenticationInfoOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AuthenticationInfo) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return A list containing the schemes. + */ + java.util.List + getSchemesList(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @return The count of schemes. + */ + int getSchemesCount(); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the element to return. + * @return The schemes at the given index. + */ + java.lang.String getSchemes(int index); + /** + *
+   * Supported authentication schemes - e.g. Basic, Bearer, etc
+   * 
+ * + * repeated string schemes = 1; + * @param index The index of the value to return. + * @return The bytes of the schemes at the given index. + */ + com.google.protobuf.ByteString + getSchemesBytes(int index); + + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The credentials. + */ + java.lang.String getCredentials(); + /** + *
+   * Optional credentials
+   * 
+ * + * string credentials = 2; + * @return The bytes for credentials. + */ + com.google.protobuf.ByteString + getCredentialsBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java new file mode 100644 index 000000000..67684f8bc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlow.java @@ -0,0 +1,1213 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.AuthorizationCodeOAuthFlow} + */ +@com.google.protobuf.Generated +public final class AuthorizationCodeOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.AuthorizationCodeOAuthFlow) + AuthorizationCodeOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "AuthorizationCodeOAuthFlow"); + } + // Use AuthorizationCodeOAuthFlow.newBuilder() to construct. + private AuthorizationCodeOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private AuthorizationCodeOAuthFlow() { + authorizationUrl_ = ""; + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder.class); + } + + public static final int AUTHORIZATION_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object authorizationUrl_ = ""; + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + @java.lang.Override + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } + } + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOKEN_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 4; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 4); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) obj; + + if (!getAuthorizationUrl() + .equals(other.getAuthorizationUrl())) return false; + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUTHORIZATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationUrl().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.AuthorizationCodeOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.AuthorizationCodeOAuthFlow) + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 4: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + authorizationUrl_ = ""; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_AuthorizationCodeOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.authorizationUrl_ = authorizationUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance()) return this; + if (!other.getAuthorizationUrl().isEmpty()) { + authorizationUrl_ = other.authorizationUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000004; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000008; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + authorizationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object authorizationUrl_ = ""; + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return This builder for chaining. + */ + public Builder clearAuthorizationUrl() { + authorizationUrl_ = getDefaultInstance().getAuthorizationUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The bytes for authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 2; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 3; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000008; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000008); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000008; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000008; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 4; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000008; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.AuthorizationCodeOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.AuthorizationCodeOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AuthorizationCodeOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java new file mode 100644 index 000000000..399a78bcb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/AuthorizationCodeOAuthFlowOrBuilder.java @@ -0,0 +1,137 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface AuthorizationCodeOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.AuthorizationCodeOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + java.lang.String getAuthorizationUrl(); + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + com.google.protobuf.ByteString + getAuthorizationUrlBytes(); + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 2; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 3; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 4; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java new file mode 100644 index 000000000..45aeb9c3c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.CancelTaskRequest} + */ +@com.google.protobuf.Generated +public final class CancelTaskRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.CancelTaskRequest) + CancelTaskRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "CancelTaskRequest"); + } + // Use CancelTaskRequest.newBuilder() to construct. + private CancelTaskRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private CancelTaskRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.CancelTaskRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest other = (org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.CancelTaskRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.CancelTaskRequest) + org.a2aproject.sdk.compat03.grpc.CancelTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CancelTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.class, org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CancelTaskRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest build() { + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result = new org.a2aproject.sdk.compat03.grpc.CancelTaskRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.CancelTaskRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.CancelTaskRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.CancelTaskRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.CancelTaskRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.CancelTaskRequest) + private static final org.a2aproject.sdk.compat03.grpc.CancelTaskRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.CancelTaskRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CancelTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CancelTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java new file mode 100644 index 000000000..f46dc46c2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CancelTaskRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface CancelTaskRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.CancelTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java new file mode 100644 index 000000000..71929e6e9 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ClientCredentialsOAuthFlow} + */ +@com.google.protobuf.Generated +public final class ClientCredentialsOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ClientCredentialsOAuthFlow) + ClientCredentialsOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ClientCredentialsOAuthFlow"); + } + // Use ClientCredentialsOAuthFlow.newBuilder() to construct. + private ClientCredentialsOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ClientCredentialsOAuthFlow() { + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder.class); + } + + public static final int TOKEN_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) obj; + + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ClientCredentialsOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ClientCredentialsOAuthFlow) + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ClientCredentialsOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance()) return this; + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ClientCredentialsOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ClientCredentialsOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ClientCredentialsOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java new file mode 100644 index 000000000..11ce5b1e2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ClientCredentialsOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ClientCredentialsOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ClientCredentialsOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..552575d17 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequest.java @@ -0,0 +1,866 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.CreateTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class CreateTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.CreateTaskPushNotificationConfigRequest) + CreateTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "CreateTaskPushNotificationConfigRequest"); + } + // Use CreateTaskPushNotificationConfigRequest.newBuilder() to construct. + private CreateTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private CreateTaskPushNotificationConfigRequest() { + parent_ = ""; + configId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object configId_ = ""; + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + @java.lang.Override + public java.lang.String getConfigId() { + java.lang.Object ref = configId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + configId_ = s; + return s; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getConfigIdBytes() { + java.lang.Object ref = configId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + configId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONFIG_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config_; + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + @java.lang.Override + public boolean hasConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig() { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder() { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(configId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, configId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getConfig()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(configId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, configId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getConfig()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) obj; + + if (!getParent() + .equals(other.getParent())) return false; + if (!getConfigId() + .equals(other.getConfigId())) return false; + if (hasConfig() != other.hasConfig()) return false; + if (hasConfig()) { + if (!getConfig() + .equals(other.getConfig())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + CONFIG_ID_FIELD_NUMBER; + hash = (53 * hash) + getConfigId().hashCode(); + if (hasConfig()) { + hash = (37 * hash) + CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getConfig().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.CreateTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.CreateTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetConfigFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + configId_ = ""; + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_CreateTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.configId_ = configId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.config_ = configBuilder_ == null + ? config_ + : configBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getConfigId().isEmpty()) { + configId_ = other.configId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasConfig()) { + mergeConfig(other.getConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + configId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetConfigFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The task resource for this config.
+     * Format: tasks/{id}
+     * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object configId_ = ""; + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + public java.lang.String getConfigId() { + java.lang.Object ref = configId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + configId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + public com.google.protobuf.ByteString + getConfigIdBytes() { + java.lang.Object ref = configId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + configId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The configId to set. + * @return This builder for chaining. + */ + public Builder setConfigId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + configId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearConfigId() { + configId_ = getDefaultInstance().getConfigId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for configId to set. + * @return This builder for chaining. + */ + public Builder setConfigIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + configId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> configBuilder_; + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + public boolean hasConfig() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig() { + if (configBuilder_ == null) { + return config_ == null ? org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } else { + return configBuilder_.getMessage(); + } + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + config_ = value; + } else { + configBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setConfig( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configBuilder_ == null) { + config_ = builderForValue.build(); + } else { + configBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + config_ != null && + config_ != org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()) { + getConfigBuilder().mergeFrom(value); + } else { + config_ = value; + } + } else { + configBuilder_.mergeFrom(value); + } + if (config_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearConfig() { + bitField0_ = (bitField0_ & ~0x00000004); + config_ = null; + if (configBuilder_ != null) { + configBuilder_.dispose(); + configBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder getConfigBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetConfigFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder() { + if (configBuilder_ != null) { + return configBuilder_.getMessageOrBuilder(); + } else { + return config_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance() : config_; + } + } + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> + internalGetConfigFieldBuilder() { + if (configBuilder_ == null) { + configBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder>( + getConfig(), + getParentForChildren(), + isClean()); + config_ = null; + } + return configBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.CreateTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.CreateTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..ce25ef2c4 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/CreateTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface CreateTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.CreateTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The parent. + */ + java.lang.String getParent(); + /** + *
+   * The task resource for this config.
+   * Format: tasks/{id}
+   * 
+ * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for parent. + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The configId. + */ + java.lang.String getConfigId(); + /** + * string config_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for configId. + */ + com.google.protobuf.ByteString + getConfigIdBytes(); + + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return Whether the config field is set. + */ + boolean hasConfig(); + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return The config. + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfig(); + /** + * .a2a.v1.TaskPushNotificationConfig config = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java new file mode 100644 index 000000000..f3018f786 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPart.java @@ -0,0 +1,567 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * DataPart represents a structured blob. This is most commonly a JSON payload.
+ * 
+ * + * Protobuf type {@code a2a.v1.DataPart} + */ +@com.google.protobuf.Generated +public final class DataPart extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.DataPart) + DataPartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "DataPart"); + } + // Use DataPart.newBuilder() to construct. + private DataPart(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private DataPart() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DataPart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DataPart.class, org.a2aproject.sdk.compat03.grpc.DataPart.Builder.class); + } + + private int bitField0_; + public static final int DATA_FIELD_NUMBER = 1; + private com.google.protobuf.Struct data_; + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.Struct getData() { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } + /** + * .google.protobuf.Struct data = 1; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getDataOrBuilder() { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getData()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getData()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.DataPart)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.DataPart other = (org.a2aproject.sdk.compat03.grpc.DataPart) obj; + + if (hasData() != other.hasData()) return false; + if (hasData()) { + if (!getData() + .equals(other.getData())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasData()) { + hash = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getData().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DataPart parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.DataPart prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * DataPart represents a structured blob. This is most commonly a JSON payload.
+   * 
+ * + * Protobuf type {@code a2a.v1.DataPart} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.DataPart) + org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DataPart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DataPart.class, org.a2aproject.sdk.compat03.grpc.DataPart.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetDataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + data_ = null; + if (dataBuilder_ != null) { + dataBuilder_.dispose(); + dataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DataPart_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart build() { + org.a2aproject.sdk.compat03.grpc.DataPart result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart buildPartial() { + org.a2aproject.sdk.compat03.grpc.DataPart result = new org.a2aproject.sdk.compat03.grpc.DataPart(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.DataPart result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.data_ = dataBuilder_ == null + ? data_ + : dataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.DataPart) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.DataPart)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.DataPart other) { + if (other == org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance()) return this; + if (other.hasData()) { + mergeData(other.getData()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetDataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.Struct data_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> dataBuilder_; + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + public boolean hasData() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + public com.google.protobuf.Struct getData() { + if (dataBuilder_ == null) { + return data_ == null ? com.google.protobuf.Struct.getDefaultInstance() : data_; + } else { + return dataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder setData(com.google.protobuf.Struct value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + data_ = value; + } else { + dataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder setData( + com.google.protobuf.Struct.Builder builderForValue) { + if (dataBuilder_ == null) { + data_ = builderForValue.build(); + } else { + dataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder mergeData(com.google.protobuf.Struct value) { + if (dataBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + data_ != null && + data_ != com.google.protobuf.Struct.getDefaultInstance()) { + getDataBuilder().mergeFrom(value); + } else { + data_ = value; + } + } else { + dataBuilder_.mergeFrom(value); + } + if (data_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public Builder clearData() { + bitField0_ = (bitField0_ & ~0x00000001); + data_ = null; + if (dataBuilder_ != null) { + dataBuilder_.dispose(); + dataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Struct data = 1; + */ + public com.google.protobuf.Struct.Builder getDataBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetDataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Struct data = 1; + */ + public com.google.protobuf.StructOrBuilder getDataOrBuilder() { + if (dataBuilder_ != null) { + return dataBuilder_.getMessageOrBuilder(); + } else { + return data_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : data_; + } + } + /** + * .google.protobuf.Struct data = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetDataFieldBuilder() { + if (dataBuilder_ == null) { + dataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getData(), + getParentForChildren(), + isClean()); + data_ = null; + } + return dataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.DataPart) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.DataPart) + private static final org.a2aproject.sdk.compat03.grpc.DataPart DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.DataPart(); + } + + public static org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DataPart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java new file mode 100644 index 000000000..cf387c020 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DataPartOrBuilder.java @@ -0,0 +1,27 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface DataPartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.DataPart) + com.google.protobuf.MessageOrBuilder { + + /** + * .google.protobuf.Struct data = 1; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .google.protobuf.Struct data = 1; + * @return The data. + */ + com.google.protobuf.Struct getData(); + /** + * .google.protobuf.Struct data = 1; + */ + com.google.protobuf.StructOrBuilder getDataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..ac8ab823d --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.DeleteTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class DeleteTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.DeleteTaskPushNotificationConfigRequest) + DeleteTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "DeleteTaskPushNotificationConfigRequest"); + } + // Use DeleteTaskPushNotificationConfigRequest.newBuilder() to construct. + private DeleteTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private DeleteTaskPushNotificationConfigRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.DeleteTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.DeleteTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_DeleteTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.DeleteTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.DeleteTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..574779a54 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/DeleteTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface DeleteTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.DeleteTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java new file mode 100644 index 000000000..b5c4b7bb8 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePart.java @@ -0,0 +1,855 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * FilePart represents the different ways files can be provided. If files are
+ * small, directly feeding the bytes is supported via file_with_bytes. If the
+ * file is large, the agent should read the content as appropriate directly
+ * from the file_with_uri source.
+ * 
+ * + * Protobuf type {@code a2a.v1.FilePart} + */ +@com.google.protobuf.Generated +public final class FilePart extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.FilePart) + FilePartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "FilePart"); + } + // Use FilePart.newBuilder() to construct. + private FilePart(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private FilePart() { + mimeType_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_FilePart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.FilePart.class, org.a2aproject.sdk.compat03.grpc.FilePart.Builder.class); + } + + private int fileCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object file_; + public enum FileCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + FILE_WITH_URI(1), + FILE_WITH_BYTES(2), + FILE_NOT_SET(0); + private final int value; + private FileCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static FileCase valueOf(int value) { + return forNumber(value); + } + + public static FileCase forNumber(int value) { + switch (value) { + case 1: return FILE_WITH_URI; + case 2: return FILE_WITH_BYTES; + case 0: return FILE_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public FileCase + getFileCase() { + return FileCase.forNumber( + fileCase_); + } + + public static final int FILE_WITH_URI_FIELD_NUMBER = 1; + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + public boolean hasFileWithUri() { + return fileCase_ == 1; + } + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + public java.lang.String getFileWithUri() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (fileCase_ == 1) { + file_ = s; + } + return s; + } + } + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + public com.google.protobuf.ByteString + getFileWithUriBytes() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (fileCase_ == 1) { + file_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILE_WITH_BYTES_FIELD_NUMBER = 2; + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + @java.lang.Override + public boolean hasFileWithBytes() { + return fileCase_ == 2; + } + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + @java.lang.Override + public com.google.protobuf.ByteString getFileWithBytes() { + if (fileCase_ == 2) { + return (com.google.protobuf.ByteString) file_; + } + return com.google.protobuf.ByteString.EMPTY; + } + + public static final int MIME_TYPE_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object mimeType_ = ""; + /** + * string mime_type = 3; + * @return The mimeType. + */ + @java.lang.Override + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } + } + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (fileCase_ == 1) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, file_); + } + if (fileCase_ == 2) { + output.writeBytes( + 2, (com.google.protobuf.ByteString) file_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(mimeType_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, mimeType_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (fileCase_ == 1) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, file_); + } + if (fileCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize( + 2, (com.google.protobuf.ByteString) file_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(mimeType_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, mimeType_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.FilePart)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.FilePart other = (org.a2aproject.sdk.compat03.grpc.FilePart) obj; + + if (!getMimeType() + .equals(other.getMimeType())) return false; + if (!getFileCase().equals(other.getFileCase())) return false; + switch (fileCase_) { + case 1: + if (!getFileWithUri() + .equals(other.getFileWithUri())) return false; + break; + case 2: + if (!getFileWithBytes() + .equals(other.getFileWithBytes())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MIME_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMimeType().hashCode(); + switch (fileCase_) { + case 1: + hash = (37 * hash) + FILE_WITH_URI_FIELD_NUMBER; + hash = (53 * hash) + getFileWithUri().hashCode(); + break; + case 2: + hash = (37 * hash) + FILE_WITH_BYTES_FIELD_NUMBER; + hash = (53 * hash) + getFileWithBytes().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.FilePart parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.FilePart prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * FilePart represents the different ways files can be provided. If files are
+   * small, directly feeding the bytes is supported via file_with_bytes. If the
+   * file is large, the agent should read the content as appropriate directly
+   * from the file_with_uri source.
+   * 
+ * + * Protobuf type {@code a2a.v1.FilePart} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.FilePart) + org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_FilePart_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.FilePart.class, org.a2aproject.sdk.compat03.grpc.FilePart.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + mimeType_ = ""; + fileCase_ = 0; + file_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_FilePart_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart build() { + org.a2aproject.sdk.compat03.grpc.FilePart result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart buildPartial() { + org.a2aproject.sdk.compat03.grpc.FilePart result = new org.a2aproject.sdk.compat03.grpc.FilePart(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.FilePart result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.mimeType_ = mimeType_; + } + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.FilePart result) { + result.fileCase_ = fileCase_; + result.file_ = this.file_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.FilePart) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.FilePart)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.FilePart other) { + if (other == org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance()) return this; + if (!other.getMimeType().isEmpty()) { + mimeType_ = other.mimeType_; + bitField0_ |= 0x00000004; + onChanged(); + } + switch (other.getFileCase()) { + case FILE_WITH_URI: { + fileCase_ = 1; + file_ = other.file_; + onChanged(); + break; + } + case FILE_WITH_BYTES: { + setFileWithBytes(other.getFileWithBytes()); + break; + } + case FILE_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + fileCase_ = 1; + file_ = s; + break; + } // case 10 + case 18: { + file_ = input.readBytes(); + fileCase_ = 2; + break; + } // case 18 + case 26: { + mimeType_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int fileCase_ = 0; + private java.lang.Object file_; + public FileCase + getFileCase() { + return FileCase.forNumber( + fileCase_); + } + + public Builder clearFile() { + fileCase_ = 0; + file_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + @java.lang.Override + public boolean hasFileWithUri() { + return fileCase_ == 1; + } + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + @java.lang.Override + public java.lang.String getFileWithUri() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (fileCase_ == 1) { + file_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getFileWithUriBytes() { + java.lang.Object ref = ""; + if (fileCase_ == 1) { + ref = file_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (fileCase_ == 1) { + file_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string file_with_uri = 1; + * @param value The fileWithUri to set. + * @return This builder for chaining. + */ + public Builder setFileWithUri( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + fileCase_ = 1; + file_ = value; + onChanged(); + return this; + } + /** + * string file_with_uri = 1; + * @return This builder for chaining. + */ + public Builder clearFileWithUri() { + if (fileCase_ == 1) { + fileCase_ = 0; + file_ = null; + onChanged(); + } + return this; + } + /** + * string file_with_uri = 1; + * @param value The bytes for fileWithUri to set. + * @return This builder for chaining. + */ + public Builder setFileWithUriBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + fileCase_ = 1; + file_ = value; + onChanged(); + return this; + } + + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + public boolean hasFileWithBytes() { + return fileCase_ == 2; + } + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + public com.google.protobuf.ByteString getFileWithBytes() { + if (fileCase_ == 2) { + return (com.google.protobuf.ByteString) file_; + } + return com.google.protobuf.ByteString.EMPTY; + } + /** + * bytes file_with_bytes = 2; + * @param value The fileWithBytes to set. + * @return This builder for chaining. + */ + public Builder setFileWithBytes(com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + fileCase_ = 2; + file_ = value; + onChanged(); + return this; + } + /** + * bytes file_with_bytes = 2; + * @return This builder for chaining. + */ + public Builder clearFileWithBytes() { + if (fileCase_ == 2) { + fileCase_ = 0; + file_ = null; + onChanged(); + } + return this; + } + + private java.lang.Object mimeType_ = ""; + /** + * string mime_type = 3; + * @return The mimeType. + */ + public java.lang.String getMimeType() { + java.lang.Object ref = mimeType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + mimeType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + public com.google.protobuf.ByteString + getMimeTypeBytes() { + java.lang.Object ref = mimeType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + mimeType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string mime_type = 3; + * @param value The mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeType( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + mimeType_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * string mime_type = 3; + * @return This builder for chaining. + */ + public Builder clearMimeType() { + mimeType_ = getDefaultInstance().getMimeType(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * string mime_type = 3; + * @param value The bytes for mimeType to set. + * @return This builder for chaining. + */ + public Builder setMimeTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + mimeType_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.FilePart) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.FilePart) + private static final org.a2aproject.sdk.compat03.grpc.FilePart DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.FilePart(); + } + + public static org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public FilePart parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java new file mode 100644 index 000000000..8ce37ca51 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/FilePartOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface FilePartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.FilePart) + com.google.protobuf.MessageOrBuilder { + + /** + * string file_with_uri = 1; + * @return Whether the fileWithUri field is set. + */ + boolean hasFileWithUri(); + /** + * string file_with_uri = 1; + * @return The fileWithUri. + */ + java.lang.String getFileWithUri(); + /** + * string file_with_uri = 1; + * @return The bytes for fileWithUri. + */ + com.google.protobuf.ByteString + getFileWithUriBytes(); + + /** + * bytes file_with_bytes = 2; + * @return Whether the fileWithBytes field is set. + */ + boolean hasFileWithBytes(); + /** + * bytes file_with_bytes = 2; + * @return The fileWithBytes. + */ + com.google.protobuf.ByteString getFileWithBytes(); + + /** + * string mime_type = 3; + * @return The mimeType. + */ + java.lang.String getMimeType(); + /** + * string mime_type = 3; + * @return The bytes for mimeType. + */ + com.google.protobuf.ByteString + getMimeTypeBytes(); + + org.a2aproject.sdk.compat03.grpc.FilePart.FileCase getFileCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java new file mode 100644 index 000000000..7cb6faad8 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequest.java @@ -0,0 +1,367 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Empty. Added to fix linter violation.
+ * 
+ * + * Protobuf type {@code a2a.v1.GetAgentCardRequest} + */ +@com.google.protobuf.Generated +public final class GetAgentCardRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetAgentCardRequest) + GetAgentCardRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetAgentCardRequest"); + } + // Use GetAgentCardRequest.newBuilder() to construct. + private GetAgentCardRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetAgentCardRequest() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.Builder.class); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest other = (org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) obj; + + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Empty. Added to fix linter violation.
+   * 
+ * + * Protobuf type {@code a2a.v1.GetAgentCardRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetAgentCardRequest) + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetAgentCardRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.class, org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetAgentCardRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest build() { + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest result = new org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest.getDefaultInstance()) return this; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetAgentCardRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetAgentCardRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetAgentCardRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java new file mode 100644 index 000000000..0edb8f504 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetAgentCardRequestOrBuilder.java @@ -0,0 +1,12 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetAgentCardRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetAgentCardRequest) + com.google.protobuf.MessageOrBuilder { +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..0ad468c5e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.GetTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class GetTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetTaskPushNotificationConfigRequest) + GetTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetTaskPushNotificationConfigRequest"); + } + // Use GetTaskPushNotificationConfigRequest.newBuilder() to construct. + private GetTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetTaskPushNotificationConfigRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.GetTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{push_id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..9cbc1a224 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{push_id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java new file mode 100644 index 000000000..748932386 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequest.java @@ -0,0 +1,596 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.GetTaskRequest} + */ +@com.google.protobuf.Generated +public final class GetTaskRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.GetTaskRequest) + GetTaskRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "GetTaskRequest"); + } + // Use GetTaskRequest.newBuilder() to construct. + private GetTaskRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private GetTaskRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int HISTORY_LENGTH_FIELD_NUMBER = 2; + private int historyLength_ = 0; + /** + * int32 history_length = 2; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (historyLength_ != 0) { + output.writeInt32(2, historyLength_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (historyLength_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, historyLength_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.GetTaskRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.GetTaskRequest other = (org.a2aproject.sdk.compat03.grpc.GetTaskRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (getHistoryLength() + != other.getHistoryLength()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + HISTORY_LENGTH_FIELD_NUMBER; + hash = (53 * hash) + getHistoryLength(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.GetTaskRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.GetTaskRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.GetTaskRequest) + org.a2aproject.sdk.compat03.grpc.GetTaskRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.GetTaskRequest.class, org.a2aproject.sdk.compat03.grpc.GetTaskRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.GetTaskRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + historyLength_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_GetTaskRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest build() { + org.a2aproject.sdk.compat03.grpc.GetTaskRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.GetTaskRequest result = new org.a2aproject.sdk.compat03.grpc.GetTaskRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.GetTaskRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.historyLength_ = historyLength_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.GetTaskRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.GetTaskRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.GetTaskRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.GetTaskRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getHistoryLength() != 0) { + setHistoryLength(other.getHistoryLength()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: { + historyLength_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int historyLength_ ; + /** + * int32 history_length = 2; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + /** + * int32 history_length = 2; + * @param value The historyLength to set. + * @return This builder for chaining. + */ + public Builder setHistoryLength(int value) { + + historyLength_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * int32 history_length = 2; + * @return This builder for chaining. + */ + public Builder clearHistoryLength() { + bitField0_ = (bitField0_ & ~0x00000002); + historyLength_ = 0; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.GetTaskRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.GetTaskRequest) + private static final org.a2aproject.sdk.compat03.grpc.GetTaskRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.GetTaskRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTaskRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.GetTaskRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java new file mode 100644 index 000000000..d694fa444 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/GetTaskRequestOrBuilder.java @@ -0,0 +1,38 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface GetTaskRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.GetTaskRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * int32 history_length = 2; + * @return The historyLength. + */ + int getHistoryLength(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java new file mode 100644 index 000000000..dbc707e9e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecurityScheme.java @@ -0,0 +1,893 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.HTTPAuthSecurityScheme} + */ +@com.google.protobuf.Generated +public final class HTTPAuthSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.HTTPAuthSecurityScheme) + HTTPAuthSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "HTTPAuthSecurityScheme"); + } + // Use HTTPAuthSecurityScheme.newBuilder() to construct. + private HTTPAuthSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private HTTPAuthSecurityScheme() { + description_ = ""; + scheme_ = ""; + bearerFormat_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEME_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object scheme_ = ""; + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The scheme. + */ + @java.lang.Override + public java.lang.String getScheme() { + java.lang.Object ref = scheme_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scheme_ = s; + return s; + } + } + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getSchemeBytes() { + java.lang.Object ref = scheme_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + scheme_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BEARER_FORMAT_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object bearerFormat_ = ""; + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + @java.lang.Override + public java.lang.String getBearerFormat() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bearerFormat_ = s; + return s; + } + } + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getBearerFormatBytes() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + bearerFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(scheme_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, scheme_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bearerFormat_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, bearerFormat_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(scheme_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, scheme_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(bearerFormat_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, bearerFormat_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getScheme() + .equals(other.getScheme())) return false; + if (!getBearerFormat() + .equals(other.getBearerFormat())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getScheme().hashCode(); + hash = (37 * hash) + BEARER_FORMAT_FIELD_NUMBER; + hash = (53 * hash) + getBearerFormat().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.HTTPAuthSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.HTTPAuthSecurityScheme) + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + scheme_ = ""; + bearerFormat_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_HTTPAuthSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.scheme_ = scheme_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.bearerFormat_ = bearerFormat_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getScheme().isEmpty()) { + scheme_ = other.scheme_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getBearerFormat().isEmpty()) { + bearerFormat_ = other.bearerFormat_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + scheme_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + bearerFormat_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object scheme_ = ""; + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return The scheme. + */ + public java.lang.String getScheme() { + java.lang.Object ref = scheme_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + scheme_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + public com.google.protobuf.ByteString + getSchemeBytes() { + java.lang.Object ref = scheme_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + scheme_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @param value The scheme to set. + * @return This builder for chaining. + */ + public Builder setScheme( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + scheme_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @return This builder for chaining. + */ + public Builder clearScheme() { + scheme_ = getDefaultInstance().getScheme(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The name of the HTTP Authentication scheme to be used in the
+     * Authorization header as defined in RFC7235. The values used SHOULD be
+     * registered in the IANA Authentication Scheme registry.
+     * The value is case-insensitive, as defined in RFC7235.
+     * 
+ * + * string scheme = 2; + * @param value The bytes for scheme to set. + * @return This builder for chaining. + */ + public Builder setSchemeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + scheme_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object bearerFormat_ = ""; + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + public java.lang.String getBearerFormat() { + java.lang.Object ref = bearerFormat_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + bearerFormat_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + public com.google.protobuf.ByteString + getBearerFormatBytes() { + java.lang.Object ref = bearerFormat_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + bearerFormat_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @param value The bearerFormat to set. + * @return This builder for chaining. + */ + public Builder setBearerFormat( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + bearerFormat_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @return This builder for chaining. + */ + public Builder clearBearerFormat() { + bearerFormat_ = getDefaultInstance().getBearerFormat(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A hint to the client to identify how the bearer token is formatted.
+     * Bearer tokens are usually generated by an authorization server, so
+     * this information is primarily for documentation purposes.
+     * 
+ * + * string bearer_format = 3; + * @param value The bytes for bearerFormat to set. + * @return This builder for chaining. + */ + public Builder setBearerFormatBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + bearerFormat_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.HTTPAuthSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.HTTPAuthSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public HTTPAuthSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..93fff9618 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/HTTPAuthSecuritySchemeOrBuilder.java @@ -0,0 +1,82 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface HTTPAuthSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.HTTPAuthSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The scheme. + */ + java.lang.String getScheme(); + /** + *
+   * The name of the HTTP Authentication scheme to be used in the
+   * Authorization header as defined in RFC7235. The values used SHOULD be
+   * registered in the IANA Authentication Scheme registry.
+   * The value is case-insensitive, as defined in RFC7235.
+   * 
+ * + * string scheme = 2; + * @return The bytes for scheme. + */ + com.google.protobuf.ByteString + getSchemeBytes(); + + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bearerFormat. + */ + java.lang.String getBearerFormat(); + /** + *
+   * A hint to the client to identify how the bearer token is formatted.
+   * Bearer tokens are usually generated by an authorization server, so
+   * this information is primarily for documentation purposes.
+   * 
+ * + * string bearer_format = 3; + * @return The bytes for bearerFormat. + */ + com.google.protobuf.ByteString + getBearerFormatBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java new file mode 100644 index 000000000..f39a28521 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ImplicitOAuthFlow} + */ +@com.google.protobuf.Generated +public final class ImplicitOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ImplicitOAuthFlow) + ImplicitOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ImplicitOAuthFlow"); + } + // Use ImplicitOAuthFlow.newBuilder() to construct. + private ImplicitOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ImplicitOAuthFlow() { + authorizationUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder.class); + } + + public static final int AUTHORIZATION_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object authorizationUrl_ = ""; + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + @java.lang.Override + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } + } + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(authorizationUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, authorizationUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) obj; + + if (!getAuthorizationUrl() + .equals(other.getAuthorizationUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AUTHORIZATION_URL_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ImplicitOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ImplicitOAuthFlow) + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + authorizationUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ImplicitOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.authorizationUrl_ = authorizationUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance()) return this; + if (!other.getAuthorizationUrl().isEmpty()) { + authorizationUrl_ = other.authorizationUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + authorizationUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object authorizationUrl_ = ""; + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + public java.lang.String getAuthorizationUrl() { + java.lang.Object ref = authorizationUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + authorizationUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + public com.google.protobuf.ByteString + getAuthorizationUrlBytes() { + java.lang.Object ref = authorizationUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + authorizationUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @return This builder for chaining. + */ + public Builder clearAuthorizationUrl() { + authorizationUrl_ = getDefaultInstance().getAuthorizationUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The authorization URL to be used for this flow. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS
+     * 
+ * + * string authorization_url = 1; + * @param value The bytes for authorizationUrl to set. + * @return This builder for chaining. + */ + public Builder setAuthorizationUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + authorizationUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ImplicitOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ImplicitOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ImplicitOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java new file mode 100644 index 000000000..47a7e6670 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ImplicitOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ImplicitOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ImplicitOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The authorizationUrl. + */ + java.lang.String getAuthorizationUrl(); + /** + *
+   * The authorization URL to be used for this flow. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS
+   * 
+ * + * string authorization_url = 1; + * @return The bytes for authorizationUrl. + */ + com.google.protobuf.ByteString + getAuthorizationUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..fadccb7cc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequest.java @@ -0,0 +1,819 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigRequest} + */ +@com.google.protobuf.Generated +public final class ListTaskPushNotificationConfigRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ListTaskPushNotificationConfigRequest) + ListTaskPushNotificationConfigRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ListTaskPushNotificationConfigRequest"); + } + // Use ListTaskPushNotificationConfigRequest.newBuilder() to construct. + private ListTaskPushNotificationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ListTaskPushNotificationConfigRequest() { + parent_ = ""; + pageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_ = 0; + /** + *
+   * For AIP-158 these fields are present. Usually not used/needed.
+   * The maximum number of configurations to return.
+   * If unspecified, all configs will be returned.
+   * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, pageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, pageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest other = (org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) obj; + + if (!getParent() + .equals(other.getParent())) return false; + if (getPageSize() + != other.getPageSize()) return false; + if (!getPageToken() + .equals(other.getPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ListTaskPushNotificationConfigRequest) + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest build() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString + getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * parent=tasks/{id}
+     * 
+ * + * string parent = 1; + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int pageSize_ ; + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * For AIP-158 these fields are present. Usually not used/needed.
+     * The maximum number of configurations to return.
+     * If unspecified, all configs will be returned.
+     * 
+ * + * int32 page_size = 2; + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000002); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString + getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * A page token received from a previous
+     * ListTaskPushNotificationConfigRequest call.
+     * Provide this to retrieve the subsequent page.
+     * When paginating, all other parameters provided to
+     * `ListTaskPushNotificationConfigRequest` must match the call that provided
+     * the page token.
+     * 
+ * + * string page_token = 3; + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ListTaskPushNotificationConfigRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ListTaskPushNotificationConfigRequest) + private static final org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTaskPushNotificationConfigRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java new file mode 100644 index 000000000..d49631f83 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigRequestOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ListTaskPushNotificationConfigRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ListTaskPushNotificationConfigRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The parent. + */ + java.lang.String getParent(); + /** + *
+   * parent=tasks/{id}
+   * 
+ * + * string parent = 1; + * @return The bytes for parent. + */ + com.google.protobuf.ByteString + getParentBytes(); + + /** + *
+   * For AIP-158 these fields are present. Usually not used/needed.
+   * The maximum number of configurations to return.
+   * If unspecified, all configs will be returned.
+   * 
+ * + * int32 page_size = 2; + * @return The pageSize. + */ + int getPageSize(); + + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + *
+   * A page token received from a previous
+   * ListTaskPushNotificationConfigRequest call.
+   * Provide this to retrieve the subsequent page.
+   * When paginating, all other parameters provided to
+   * `ListTaskPushNotificationConfigRequest` must match the call that provided
+   * the page token.
+   * 
+ * + * string page_token = 3; + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString + getPageTokenBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..3d3e24473 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponse.java @@ -0,0 +1,891 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigResponse} + */ +@com.google.protobuf.Generated +public final class ListTaskPushNotificationConfigResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.ListTaskPushNotificationConfigResponse) + ListTaskPushNotificationConfigResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "ListTaskPushNotificationConfigResponse"); + } + // Use ListTaskPushNotificationConfigResponse.newBuilder() to construct. + private ListTaskPushNotificationConfigResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private ListTaskPushNotificationConfigResponse() { + configs_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder.class); + } + + public static final int CONFIGS_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private java.util.List configs_; + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public java.util.List getConfigsList() { + return configs_; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public java.util.List + getConfigsOrBuilderList() { + return configs_; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public int getConfigsCount() { + return configs_.size(); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index) { + return configs_.get(index); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index) { + return configs_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < configs_.size(); i++) { + output.writeMessage(1, configs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, nextPageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < configs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, configs_.get(i)); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, nextPageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse other = (org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse) obj; + + if (!getConfigsList() + .equals(other.getConfigsList())) return false; + if (!getNextPageToken() + .equals(other.getNextPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getConfigsCount() > 0) { + hash = (37 * hash) + CONFIGS_FIELD_NUMBER; + hash = (53 * hash) + getConfigsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.ListTaskPushNotificationConfigResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.ListTaskPushNotificationConfigResponse) + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.class, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (configsBuilder_ == null) { + configs_ = java.util.Collections.emptyList(); + } else { + configs_ = null; + configsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_ListTaskPushNotificationConfigResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse build() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result) { + if (configsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + configs_ = java.util.Collections.unmodifiableList(configs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.configs_ = configs_; + } else { + result.configs_ = configsBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.getDefaultInstance()) return this; + if (configsBuilder_ == null) { + if (!other.configs_.isEmpty()) { + if (configs_.isEmpty()) { + configs_ = other.configs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureConfigsIsMutable(); + configs_.addAll(other.configs_); + } + onChanged(); + } + } else { + if (!other.configs_.isEmpty()) { + if (configsBuilder_.isEmpty()) { + configsBuilder_.dispose(); + configsBuilder_ = null; + configs_ = other.configs_; + bitField0_ = (bitField0_ & ~0x00000001); + configsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetConfigsFieldBuilder() : null; + } else { + configsBuilder_.addAllMessages(other.configs_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.parser(), + extensionRegistry); + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(m); + } else { + configsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.util.List configs_ = + java.util.Collections.emptyList(); + private void ensureConfigsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + configs_ = new java.util.ArrayList(configs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> configsBuilder_; + + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List getConfigsList() { + if (configsBuilder_ == null) { + return java.util.Collections.unmodifiableList(configs_); + } else { + return configsBuilder_.getMessageList(); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public int getConfigsCount() { + if (configsBuilder_ == null) { + return configs_.size(); + } else { + return configsBuilder_.getCount(); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index) { + if (configsBuilder_ == null) { + return configs_.get(index); + } else { + return configsBuilder_.getMessage(index); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder setConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.set(index, value); + onChanged(); + } else { + configsBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder setConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.set(index, builderForValue.build()); + onChanged(); + } else { + configsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.add(value); + onChanged(); + } else { + configsBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig value) { + if (configsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureConfigsIsMutable(); + configs_.add(index, value); + onChanged(); + } else { + configsBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(builderForValue.build()); + onChanged(); + } else { + configsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addConfigs( + int index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builderForValue) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.add(index, builderForValue.build()); + onChanged(); + } else { + configsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder addAllConfigs( + java.lang.Iterable values) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, configs_); + onChanged(); + } else { + configsBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder clearConfigs() { + if (configsBuilder_ == null) { + configs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + configsBuilder_.clear(); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public Builder removeConfigs(int index) { + if (configsBuilder_ == null) { + ensureConfigsIsMutable(); + configs_.remove(index); + onChanged(); + } else { + configsBuilder_.remove(index); + } + return this; + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder getConfigsBuilder( + int index) { + return internalGetConfigsFieldBuilder().getBuilder(index); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index) { + if (configsBuilder_ == null) { + return configs_.get(index); } else { + return configsBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List + getConfigsOrBuilderList() { + if (configsBuilder_ != null) { + return configsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(configs_); + } + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder addConfigsBuilder() { + return internalGetConfigsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder addConfigsBuilder( + int index) { + return internalGetConfigsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()); + } + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + public java.util.List + getConfigsBuilderList() { + return internalGetConfigsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder> + internalGetConfigsFieldBuilder() { + if (configsBuilder_ == null) { + configsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder>( + configs_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + configs_ = null; + } + return configsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString + getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * A token, which can be sent as `page_token` to retrieve the next page.
+     * If this field is omitted, there are no subsequent pages.
+     * 
+ * + * string next_page_token = 2; + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.ListTaskPushNotificationConfigResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.ListTaskPushNotificationConfigResponse) + private static final org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTaskPushNotificationConfigResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java new file mode 100644 index 000000000..f952f588d --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/ListTaskPushNotificationConfigResponseOrBuilder.java @@ -0,0 +1,58 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface ListTaskPushNotificationConfigResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.ListTaskPushNotificationConfigResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + java.util.List + getConfigsList(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getConfigs(int index); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + int getConfigsCount(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + java.util.List + getConfigsOrBuilderList(); + /** + * repeated .a2a.v1.TaskPushNotificationConfig configs = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder getConfigsOrBuilder( + int index); + + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + *
+   * A token, which can be sent as `page_token` to retrieve the next page.
+   * If this field is omitted, there are no subsequent pages.
+   * 
+ * + * string next_page_token = 2; + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString + getNextPageTokenBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java new file mode 100644 index 000000000..7c2f25d91 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Message.java @@ -0,0 +1,1983 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Message is one unit of communication between client and server. It is
+ * associated with a context and optionally a task. Since the server is
+ * responsible for the context definition, it must always provide a context_id
+ * in its messages. The client can optionally provide the context_id if it
+ * knows the context to associate the message to. Similarly for task_id,
+ * except the server decides if a task is created and whether to include the
+ * task_id.
+ * 
+ * + * Protobuf type {@code a2a.v1.Message} + */ +@com.google.protobuf.Generated +public final class Message extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Message) + MessageOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Message"); + } + // Use Message.newBuilder() to construct. + private Message(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Message() { + messageId_ = ""; + contextId_ = ""; + taskId_ = ""; + role_ = 0; + content_ = java.util.Collections.emptyList(); + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Message.class, org.a2aproject.sdk.compat03.grpc.Message.Builder.class); + } + + private int bitField0_; + public static final int MESSAGE_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object messageId_ = ""; + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The messageId. + */ + @java.lang.Override + public java.lang.String getMessageId() { + java.lang.Object ref = messageId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + messageId_ = s; + return s; + } + } + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMessageIdBytes() { + java.lang.Object ref = messageId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + messageId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TASK_ID_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ROLE_FIELD_NUMBER = 4; + private int role_ = 0; + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + @java.lang.Override public int getRoleValue() { + return role_; + } + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + @java.lang.Override public org.a2aproject.sdk.compat03.grpc.Role getRole() { + org.a2aproject.sdk.compat03.grpc.Role result = org.a2aproject.sdk.compat03.grpc.Role.forNumber(role_); + return result == null ? org.a2aproject.sdk.compat03.grpc.Role.UNRECOGNIZED : result; + } + + public static final int CONTENT_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List content_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public java.util.List getContentList() { + return content_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public java.util.List + getContentOrBuilderList() { + return content_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public int getContentCount() { + return content_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getContent(int index) { + return content_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index) { + return content_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + public static final int EXTENSIONS_FIELD_NUMBER = 7; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + return extensions_; + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, messageId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, taskId_); + } + if (role_ != org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED.getNumber()) { + output.writeEnum(4, role_); + } + for (int i = 0; i < content_.size(); i++) { + output.writeMessage(5, content_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(6, getMetadata()); + } + for (int i = 0; i < extensions_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 7, extensions_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(messageId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, messageId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, taskId_); + } + if (role_ != org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(4, role_); + } + for (int i = 0; i < content_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, content_.get(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + { + int dataSize = 0; + for (int i = 0; i < extensions_.size(); i++) { + dataSize += computeStringSizeNoTag(extensions_.getRaw(i)); + } + size += dataSize; + size += 1 * getExtensionsList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Message)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Message other = (org.a2aproject.sdk.compat03.grpc.Message) obj; + + if (!getMessageId() + .equals(other.getMessageId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (role_ != other.role_) return false; + if (!getContentList() + .equals(other.getContentList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getExtensionsList() + .equals(other.getExtensionsList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MESSAGE_ID_FIELD_NUMBER; + hash = (53 * hash) + getMessageId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + ROLE_FIELD_NUMBER; + hash = (53 * hash) + role_; + if (getContentCount() > 0) { + hash = (37 * hash) + CONTENT_FIELD_NUMBER; + hash = (53 * hash) + getContentList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + if (getExtensionsCount() > 0) { + hash = (37 * hash) + EXTENSIONS_FIELD_NUMBER; + hash = (53 * hash) + getExtensionsList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Message parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Message parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Message prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Message is one unit of communication between client and server. It is
+   * associated with a context and optionally a task. Since the server is
+   * responsible for the context definition, it must always provide a context_id
+   * in its messages. The client can optionally provide the context_id if it
+   * knows the context to associate the message to. Similarly for task_id,
+   * except the server decides if a task is created and whether to include the
+   * task_id.
+   * 
+ * + * Protobuf type {@code a2a.v1.Message} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Message) + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Message.class, org.a2aproject.sdk.compat03.grpc.Message.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Message.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetContentFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + messageId_ = ""; + contextId_ = ""; + taskId_ = ""; + role_ = 0; + if (contentBuilder_ == null) { + content_ = java.util.Collections.emptyList(); + } else { + content_ = null; + contentBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Message_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message build() { + org.a2aproject.sdk.compat03.grpc.Message result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message buildPartial() { + org.a2aproject.sdk.compat03.grpc.Message result = new org.a2aproject.sdk.compat03.grpc.Message(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Message result) { + if (contentBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + content_ = java.util.Collections.unmodifiableList(content_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.content_ = content_; + } else { + result.content_ = contentBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Message result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.messageId_ = messageId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.role_ = role_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000040) != 0)) { + extensions_.makeImmutable(); + result.extensions_ = extensions_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Message) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Message)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Message other) { + if (other == org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) return this; + if (!other.getMessageId().isEmpty()) { + messageId_ = other.messageId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.role_ != 0) { + setRoleValue(other.getRoleValue()); + } + if (contentBuilder_ == null) { + if (!other.content_.isEmpty()) { + if (content_.isEmpty()) { + content_ = other.content_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureContentIsMutable(); + content_.addAll(other.content_); + } + onChanged(); + } + } else { + if (!other.content_.isEmpty()) { + if (contentBuilder_.isEmpty()) { + contentBuilder_.dispose(); + contentBuilder_ = null; + content_ = other.content_; + bitField0_ = (bitField0_ & ~0x00000010); + contentBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetContentFieldBuilder() : null; + } else { + contentBuilder_.addAllMessages(other.content_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + if (!other.extensions_.isEmpty()) { + if (extensions_.isEmpty()) { + extensions_ = other.extensions_; + bitField0_ |= 0x00000040; + } else { + ensureExtensionsIsMutable(); + extensions_.addAll(other.extensions_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + messageId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + role_ = input.readEnum(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: { + org.a2aproject.sdk.compat03.grpc.Part m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Part.parser(), + extensionRegistry); + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(m); + } else { + contentBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + case 58: { + java.lang.String s = input.readStringRequireUtf8(); + ensureExtensionsIsMutable(); + extensions_.add(s); + break; + } // case 58 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object messageId_ = ""; + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return The messageId. + */ + public java.lang.String getMessageId() { + java.lang.Object ref = messageId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + messageId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + public com.google.protobuf.ByteString + getMessageIdBytes() { + java.lang.Object ref = messageId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + messageId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @param value The messageId to set. + * @return This builder for chaining. + */ + public Builder setMessageId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + messageId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @return This builder for chaining. + */ + public Builder clearMessageId() { + messageId_ = getDefaultInstance().getMessageId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The message id of the message. This is required and created by the
+     * message creator.
+     * 
+ * + * string message_id = 1; + * @param value The bytes for messageId to set. + * @return This builder for chaining. + */ + public Builder setMessageIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + messageId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The context id of the message. This is optional and if set, the message
+     * will be associated with the given context.
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object taskId_ = ""; + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * The task id of the message. This is optional and if set, the message
+     * will be associated with the given task.
+     * 
+ * + * string task_id = 3; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private int role_ = 0; + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + @java.lang.Override public int getRoleValue() { + return role_; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @param value The enum numeric value on the wire for role to set. + * @return This builder for chaining. + */ + public Builder setRoleValue(int value) { + role_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Role getRole() { + org.a2aproject.sdk.compat03.grpc.Role result = org.a2aproject.sdk.compat03.grpc.Role.forNumber(role_); + return result == null ? org.a2aproject.sdk.compat03.grpc.Role.UNRECOGNIZED : result; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @param value The role to set. + * @return This builder for chaining. + */ + public Builder setRole(org.a2aproject.sdk.compat03.grpc.Role value) { + if (value == null) { throw new NullPointerException(); } + bitField0_ |= 0x00000008; + role_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * A role for the message.
+     * 
+ * + * .a2a.v1.Role role = 4; + * @return This builder for chaining. + */ + public Builder clearRole() { + bitField0_ = (bitField0_ & ~0x00000008); + role_ = 0; + onChanged(); + return this; + } + + private java.util.List content_ = + java.util.Collections.emptyList(); + private void ensureContentIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + content_ = new java.util.ArrayList(content_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> contentBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List getContentList() { + if (contentBuilder_ == null) { + return java.util.Collections.unmodifiableList(content_); + } else { + return contentBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public int getContentCount() { + if (contentBuilder_ == null) { + return content_.size(); + } else { + return contentBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part getContent(int index) { + if (contentBuilder_ == null) { + return content_.get(index); + } else { + return contentBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder setContent( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.set(index, value); + onChanged(); + } else { + contentBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder setContent( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.set(index, builderForValue.build()); + onChanged(); + } else { + contentBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent(org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.add(value); + onChanged(); + } else { + contentBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + int index, org.a2aproject.sdk.compat03.grpc.Part value) { + if (contentBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContentIsMutable(); + content_.add(index, value); + onChanged(); + } else { + contentBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(builderForValue.build()); + onChanged(); + } else { + contentBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addContent( + int index, org.a2aproject.sdk.compat03.grpc.Part.Builder builderForValue) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.add(index, builderForValue.build()); + onChanged(); + } else { + contentBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder addAllContent( + java.lang.Iterable values) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, content_); + onChanged(); + } else { + contentBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder clearContent() { + if (contentBuilder_ == null) { + content_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + contentBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public Builder removeContent(int index) { + if (contentBuilder_ == null) { + ensureContentIsMutable(); + content_.remove(index); + onChanged(); + } else { + contentBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder getContentBuilder( + int index) { + return internalGetContentFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index) { + if (contentBuilder_ == null) { + return content_.get(index); } else { + return contentBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List + getContentOrBuilderList() { + if (contentBuilder_ != null) { + return contentBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(content_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addContentBuilder() { + return internalGetContentFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Part.Builder addContentBuilder( + int index) { + return internalGetContentFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * Content is the container of the message content.
+     * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + public java.util.List + getContentBuilderList() { + return internalGetContentFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder> + internalGetContentFieldBuilder() { + if (contentBuilder_ == null) { + contentBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Part, org.a2aproject.sdk.compat03.grpc.Part.Builder, org.a2aproject.sdk.compat03.grpc.PartOrBuilder>( + content_, + ((bitField0_ & 0x00000010) != 0), + getParentForChildren(), + isClean()); + content_ = null; + } + return contentBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * Any optional metadata to provide along with the message.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + private com.google.protobuf.LazyStringArrayList extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureExtensionsIsMutable() { + if (!extensions_.isModifiable()) { + extensions_ = new com.google.protobuf.LazyStringArrayList(extensions_); + } + bitField0_ |= 0x00000040; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + public com.google.protobuf.ProtocolStringList + getExtensionsList() { + extensions_.makeImmutable(); + return extensions_; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + public int getExtensionsCount() { + return extensions_.size(); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + public java.lang.String getExtensions(int index) { + return extensions_.get(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + public com.google.protobuf.ByteString + getExtensionsBytes(int index) { + return extensions_.getByteString(index); + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param index The index to set the value at. + * @param value The extensions to set. + * @return This builder for chaining. + */ + public Builder setExtensions( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.set(index, value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param value The extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensions( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param values The extensions to add. + * @return This builder for chaining. + */ + public Builder addAllExtensions( + java.lang.Iterable values) { + ensureExtensionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, extensions_); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @return This builder for chaining. + */ + public Builder clearExtensions() { + extensions_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040);; + onChanged(); + return this; + } + /** + *
+     * The URIs of extensions that are present or contributed to this Message.
+     * 
+ * + * repeated string extensions = 7; + * @param value The bytes of the extensions to add. + * @return This builder for chaining. + */ + public Builder addExtensionsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureExtensionsIsMutable(); + extensions_.add(value); + bitField0_ |= 0x00000040; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Message) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Message) + private static final org.a2aproject.sdk.compat03.grpc.Message DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Message(); + } + + public static org.a2aproject.sdk.compat03.grpc.Message getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Message parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java new file mode 100644 index 000000000..1c7dd4f27 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MessageOrBuilder.java @@ -0,0 +1,217 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface MessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Message) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The messageId. + */ + java.lang.String getMessageId(); + /** + *
+   * The message id of the message. This is required and created by the
+   * message creator.
+   * 
+ * + * string message_id = 1; + * @return The bytes for messageId. + */ + com.google.protobuf.ByteString + getMessageIdBytes(); + + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The context id of the message. This is optional and if set, the message
+   * will be associated with the given context.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The task id of the message. This is optional and if set, the message
+   * will be associated with the given task.
+   * 
+ * + * string task_id = 3; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The enum numeric value on the wire for role. + */ + int getRoleValue(); + /** + *
+   * A role for the message.
+   * 
+ * + * .a2a.v1.Role role = 4; + * @return The role. + */ + org.a2aproject.sdk.compat03.grpc.Role getRole(); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + java.util.List + getContentList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + org.a2aproject.sdk.compat03.grpc.Part getContent(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + int getContentCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + java.util.List + getContentOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * Content is the container of the message content.
+   * 
+ * + * repeated .a2a.v1.Part content = 5; + */ + org.a2aproject.sdk.compat03.grpc.PartOrBuilder getContentOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * Any optional metadata to provide along with the message.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); + + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return A list containing the extensions. + */ + java.util.List + getExtensionsList(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @return The count of extensions. + */ + int getExtensionsCount(); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the element to return. + * @return The extensions at the given index. + */ + java.lang.String getExtensions(int index); + /** + *
+   * The URIs of extensions that are present or contributed to this Message.
+   * 
+ * + * repeated string extensions = 7; + * @param index The index of the value to return. + * @return The bytes of the extensions at the given index. + */ + com.google.protobuf.ByteString + getExtensionsBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java new file mode 100644 index 000000000..09c25957d --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecurityScheme.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.MutualTlsSecurityScheme} + */ +@com.google.protobuf.Generated +public final class MutualTlsSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.MutualTlsSecurityScheme) + MutualTlsSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "MutualTlsSecurityScheme"); + } + // Use MutualTlsSecurityScheme.newBuilder() to construct. + private MutualTlsSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private MutualTlsSecurityScheme() { + description_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.MutualTlsSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.MutualTlsSecurityScheme) + org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_MutualTlsSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.MutualTlsSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.MutualTlsSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MutualTlsSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..bae87d5d3 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/MutualTlsSecuritySchemeOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface MutualTlsSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.MutualTlsSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java new file mode 100644 index 000000000..f7d2e85ea --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecurityScheme.java @@ -0,0 +1,942 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OAuth2SecurityScheme} + */ +@com.google.protobuf.Generated +public final class OAuth2SecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OAuth2SecurityScheme) + OAuth2SecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OAuth2SecurityScheme"); + } + // Use OAuth2SecurityScheme.newBuilder() to construct. + private OAuth2SecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OAuth2SecurityScheme() { + description_ = ""; + oauth2MetadataUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder.class); + } + + private int bitField0_; + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FLOWS_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.OAuthFlows flows_; + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + @java.lang.Override + public boolean hasFlows() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows() { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder() { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + + public static final int OAUTH2_METADATA_URL_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object oauth2MetadataUrl_ = ""; + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + @java.lang.Override + public java.lang.String getOauth2MetadataUrl() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + oauth2MetadataUrl_ = s; + return s; + } + } + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOauth2MetadataUrlBytes() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oauth2MetadataUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getFlows()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(oauth2MetadataUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, oauth2MetadataUrl_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getFlows()); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(oauth2MetadataUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, oauth2MetadataUrl_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme other = (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (hasFlows() != other.hasFlows()) return false; + if (hasFlows()) { + if (!getFlows() + .equals(other.getFlows())) return false; + } + if (!getOauth2MetadataUrl() + .equals(other.getOauth2MetadataUrl())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (hasFlows()) { + hash = (37 * hash) + FLOWS_FIELD_NUMBER; + hash = (53 * hash) + getFlows().hashCode(); + } + hash = (37 * hash) + OAUTH2_METADATA_URL_FIELD_NUMBER; + hash = (53 * hash) + getOauth2MetadataUrl().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OAuth2SecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OAuth2SecurityScheme) + org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuth2SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetFlowsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + flows_ = null; + if (flowsBuilder_ != null) { + flowsBuilder_.dispose(); + flowsBuilder_ = null; + } + oauth2MetadataUrl_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuth2SecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result = new org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.flows_ = flowsBuilder_ == null + ? flows_ + : flowsBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.oauth2MetadataUrl_ = oauth2MetadataUrl_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasFlows()) { + mergeFlows(other.getFlows()); + } + if (!other.getOauth2MetadataUrl().isEmpty()) { + oauth2MetadataUrl_ = other.oauth2MetadataUrl_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetFlowsFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + oauth2MetadataUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.OAuthFlows flows_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder> flowsBuilder_; + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + public boolean hasFlows() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows() { + if (flowsBuilder_ == null) { + return flows_ == null ? org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } else { + return flowsBuilder_.getMessage(); + } + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder setFlows(org.a2aproject.sdk.compat03.grpc.OAuthFlows value) { + if (flowsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flows_ = value; + } else { + flowsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder setFlows( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder builderForValue) { + if (flowsBuilder_ == null) { + flows_ = builderForValue.build(); + } else { + flowsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder mergeFlows(org.a2aproject.sdk.compat03.grpc.OAuthFlows value) { + if (flowsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + flows_ != null && + flows_ != org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance()) { + getFlowsBuilder().mergeFrom(value); + } else { + flows_ = value; + } + } else { + flowsBuilder_.mergeFrom(value); + } + if (flows_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public Builder clearFlows() { + bitField0_ = (bitField0_ & ~0x00000002); + flows_ = null; + if (flowsBuilder_ != null) { + flowsBuilder_.dispose(); + flowsBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder getFlowsBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetFlowsFieldBuilder().getBuilder(); + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + public org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder() { + if (flowsBuilder_ != null) { + return flowsBuilder_.getMessageOrBuilder(); + } else { + return flows_ == null ? + org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance() : flows_; + } + } + /** + *
+     * An object containing configuration information for the flow types supported
+     * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder> + internalGetFlowsFieldBuilder() { + if (flowsBuilder_ == null) { + flowsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuthFlows, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder, org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder>( + getFlows(), + getParentForChildren(), + isClean()); + flows_ = null; + } + return flowsBuilder_; + } + + private java.lang.Object oauth2MetadataUrl_ = ""; + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + public java.lang.String getOauth2MetadataUrl() { + java.lang.Object ref = oauth2MetadataUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + oauth2MetadataUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + public com.google.protobuf.ByteString + getOauth2MetadataUrlBytes() { + java.lang.Object ref = oauth2MetadataUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + oauth2MetadataUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @param value The oauth2MetadataUrl to set. + * @return This builder for chaining. + */ + public Builder setOauth2MetadataUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + oauth2MetadataUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @return This builder for chaining. + */ + public Builder clearOauth2MetadataUrl() { + oauth2MetadataUrl_ = getDefaultInstance().getOauth2MetadataUrl(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * URL to the oauth2 authorization server metadata
+     * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+     * 
+ * + * string oauth2_metadata_url = 3; + * @param value The bytes for oauth2MetadataUrl to set. + * @return This builder for chaining. + */ + public Builder setOauth2MetadataUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + oauth2MetadataUrl_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OAuth2SecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OAuth2SecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OAuth2SecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java new file mode 100644 index 000000000..5c70e7de2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuth2SecuritySchemeOrBuilder.java @@ -0,0 +1,81 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OAuth2SecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OAuth2SecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return Whether the flows field is set. + */ + boolean hasFlows(); + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + * @return The flows. + */ + org.a2aproject.sdk.compat03.grpc.OAuthFlows getFlows(); + /** + *
+   * An object containing configuration information for the flow types supported
+   * 
+ * + * .a2a.v1.OAuthFlows flows = 2; + */ + org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder getFlowsOrBuilder(); + + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The oauth2MetadataUrl. + */ + java.lang.String getOauth2MetadataUrl(); + /** + *
+   * URL to the oauth2 authorization server metadata
+   * [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required.
+   * 
+ * + * string oauth2_metadata_url = 3; + * @return The bytes for oauth2MetadataUrl. + */ + com.google.protobuf.ByteString + getOauth2MetadataUrlBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java new file mode 100644 index 000000000..c136b114b --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlows.java @@ -0,0 +1,1273 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OAuthFlows} + */ +@com.google.protobuf.Generated +public final class OAuthFlows extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OAuthFlows) + OAuthFlowsOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OAuthFlows"); + } + // Use OAuthFlows.newBuilder() to construct. + private OAuthFlows(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OAuthFlows() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuthFlows_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.class, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder.class); + } + + private int flowCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object flow_; + public enum FlowCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + AUTHORIZATION_CODE(1), + CLIENT_CREDENTIALS(2), + IMPLICIT(3), + PASSWORD(4), + FLOW_NOT_SET(0); + private final int value; + private FlowCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static FlowCase valueOf(int value) { + return forNumber(value); + } + + public static FlowCase forNumber(int value) { + switch (value) { + case 1: return AUTHORIZATION_CODE; + case 2: return CLIENT_CREDENTIALS; + case 3: return IMPLICIT; + case 4: return PASSWORD; + case 0: return FLOW_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public FlowCase + getFlowCase() { + return FlowCase.forNumber( + flowCase_); + } + + public static final int AUTHORIZATION_CODE_FIELD_NUMBER = 1; + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + @java.lang.Override + public boolean hasAuthorizationCode() { + return flowCase_ == 1; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode() { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder() { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + + public static final int CLIENT_CREDENTIALS_FIELD_NUMBER = 2; + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + @java.lang.Override + public boolean hasClientCredentials() { + return flowCase_ == 2; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials() { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder() { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + + public static final int IMPLICIT_FIELD_NUMBER = 3; + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + @java.lang.Override + public boolean hasImplicit() { + return flowCase_ == 3; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit() { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder() { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + + public static final int PASSWORD_FIELD_NUMBER = 4; + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + @java.lang.Override + public boolean hasPassword() { + return flowCase_ == 4; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword() { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder() { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (flowCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_); + } + if (flowCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_); + } + if (flowCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_); + } + if (flowCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (flowCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_); + } + if (flowCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_); + } + if (flowCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_); + } + if (flowCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OAuthFlows)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OAuthFlows other = (org.a2aproject.sdk.compat03.grpc.OAuthFlows) obj; + + if (!getFlowCase().equals(other.getFlowCase())) return false; + switch (flowCase_) { + case 1: + if (!getAuthorizationCode() + .equals(other.getAuthorizationCode())) return false; + break; + case 2: + if (!getClientCredentials() + .equals(other.getClientCredentials())) return false; + break; + case 3: + if (!getImplicit() + .equals(other.getImplicit())) return false; + break; + case 4: + if (!getPassword() + .equals(other.getPassword())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (flowCase_) { + case 1: + hash = (37 * hash) + AUTHORIZATION_CODE_FIELD_NUMBER; + hash = (53 * hash) + getAuthorizationCode().hashCode(); + break; + case 2: + hash = (37 * hash) + CLIENT_CREDENTIALS_FIELD_NUMBER; + hash = (53 * hash) + getClientCredentials().hashCode(); + break; + case 3: + hash = (37 * hash) + IMPLICIT_FIELD_NUMBER; + hash = (53 * hash) + getImplicit().hashCode(); + break; + case 4: + hash = (37 * hash) + PASSWORD_FIELD_NUMBER; + hash = (53 * hash) + getPassword().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OAuthFlows prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OAuthFlows} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OAuthFlows) + org.a2aproject.sdk.compat03.grpc.OAuthFlowsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuthFlows_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OAuthFlows.class, org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OAuthFlows.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (authorizationCodeBuilder_ != null) { + authorizationCodeBuilder_.clear(); + } + if (clientCredentialsBuilder_ != null) { + clientCredentialsBuilder_.clear(); + } + if (implicitBuilder_ != null) { + implicitBuilder_.clear(); + } + if (passwordBuilder_ != null) { + passwordBuilder_.clear(); + } + flowCase_ = 0; + flow_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OAuthFlows_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows build() { + org.a2aproject.sdk.compat03.grpc.OAuthFlows result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows buildPartial() { + org.a2aproject.sdk.compat03.grpc.OAuthFlows result = new org.a2aproject.sdk.compat03.grpc.OAuthFlows(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OAuthFlows result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.OAuthFlows result) { + result.flowCase_ = flowCase_; + result.flow_ = this.flow_; + if (flowCase_ == 1 && + authorizationCodeBuilder_ != null) { + result.flow_ = authorizationCodeBuilder_.build(); + } + if (flowCase_ == 2 && + clientCredentialsBuilder_ != null) { + result.flow_ = clientCredentialsBuilder_.build(); + } + if (flowCase_ == 3 && + implicitBuilder_ != null) { + result.flow_ = implicitBuilder_.build(); + } + if (flowCase_ == 4 && + passwordBuilder_ != null) { + result.flow_ = passwordBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OAuthFlows) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OAuthFlows)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OAuthFlows other) { + if (other == org.a2aproject.sdk.compat03.grpc.OAuthFlows.getDefaultInstance()) return this; + switch (other.getFlowCase()) { + case AUTHORIZATION_CODE: { + mergeAuthorizationCode(other.getAuthorizationCode()); + break; + } + case CLIENT_CREDENTIALS: { + mergeClientCredentials(other.getClientCredentials()); + break; + } + case IMPLICIT: { + mergeImplicit(other.getImplicit()); + break; + } + case PASSWORD: { + mergePassword(other.getPassword()); + break; + } + case FLOW_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetAuthorizationCodeFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetClientCredentialsFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetImplicitFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetPasswordFieldBuilder().getBuilder(), + extensionRegistry); + flowCase_ = 4; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int flowCase_ = 0; + private java.lang.Object flow_; + public FlowCase + getFlowCase() { + return FlowCase.forNumber( + flowCase_); + } + + public Builder clearFlow() { + flowCase_ = 0; + flow_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder> authorizationCodeBuilder_; + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + @java.lang.Override + public boolean hasAuthorizationCode() { + return flowCase_ == 1; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode() { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 1) { + return authorizationCodeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder setAuthorizationCode(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow value) { + if (authorizationCodeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + authorizationCodeBuilder_.setMessage(value); + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder setAuthorizationCode( + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder builderForValue) { + if (authorizationCodeBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + authorizationCodeBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder mergeAuthorizationCode(org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow value) { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1 && + flow_ != org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 1) { + authorizationCodeBuilder_.mergeFrom(value); + } else { + authorizationCodeBuilder_.setMessage(value); + } + } + flowCase_ = 1; + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public Builder clearAuthorizationCode() { + if (authorizationCodeBuilder_ == null) { + if (flowCase_ == 1) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 1) { + flowCase_ = 0; + flow_ = null; + } + authorizationCodeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder getAuthorizationCodeBuilder() { + return internalGetAuthorizationCodeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder() { + if ((flowCase_ == 1) && (authorizationCodeBuilder_ != null)) { + return authorizationCodeBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder> + internalGetAuthorizationCodeFieldBuilder() { + if (authorizationCodeBuilder_ == null) { + if (!(flowCase_ == 1)) { + flow_ = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.getDefaultInstance(); + } + authorizationCodeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 1; + onChanged(); + return authorizationCodeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder> clientCredentialsBuilder_; + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + @java.lang.Override + public boolean hasClientCredentials() { + return flowCase_ == 2; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials() { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 2) { + return clientCredentialsBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder setClientCredentials(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow value) { + if (clientCredentialsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + clientCredentialsBuilder_.setMessage(value); + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder setClientCredentials( + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder builderForValue) { + if (clientCredentialsBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + clientCredentialsBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder mergeClientCredentials(org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow value) { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2 && + flow_ != org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 2) { + clientCredentialsBuilder_.mergeFrom(value); + } else { + clientCredentialsBuilder_.setMessage(value); + } + } + flowCase_ = 2; + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public Builder clearClientCredentials() { + if (clientCredentialsBuilder_ == null) { + if (flowCase_ == 2) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 2) { + flowCase_ = 0; + flow_ = null; + } + clientCredentialsBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder getClientCredentialsBuilder() { + return internalGetClientCredentialsFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder() { + if ((flowCase_ == 2) && (clientCredentialsBuilder_ != null)) { + return clientCredentialsBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder> + internalGetClientCredentialsFieldBuilder() { + if (clientCredentialsBuilder_ == null) { + if (!(flowCase_ == 2)) { + flow_ = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.getDefaultInstance(); + } + clientCredentialsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 2; + onChanged(); + return clientCredentialsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder> implicitBuilder_; + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + @java.lang.Override + public boolean hasImplicit() { + return flowCase_ == 3; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit() { + if (implicitBuilder_ == null) { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 3) { + return implicitBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder setImplicit(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow value) { + if (implicitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + implicitBuilder_.setMessage(value); + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder setImplicit( + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder builderForValue) { + if (implicitBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + implicitBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder mergeImplicit(org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow value) { + if (implicitBuilder_ == null) { + if (flowCase_ == 3 && + flow_ != org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 3) { + implicitBuilder_.mergeFrom(value); + } else { + implicitBuilder_.setMessage(value); + } + } + flowCase_ = 3; + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public Builder clearImplicit() { + if (implicitBuilder_ == null) { + if (flowCase_ == 3) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 3) { + flowCase_ = 0; + flow_ = null; + } + implicitBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder getImplicitBuilder() { + return internalGetImplicitFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder() { + if ((flowCase_ == 3) && (implicitBuilder_ != null)) { + return implicitBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder> + internalGetImplicitFieldBuilder() { + if (implicitBuilder_ == null) { + if (!(flowCase_ == 3)) { + flow_ = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.getDefaultInstance(); + } + implicitBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 3; + onChanged(); + return implicitBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder> passwordBuilder_; + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + @java.lang.Override + public boolean hasPassword() { + return flowCase_ == 4; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword() { + if (passwordBuilder_ == null) { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } else { + if (flowCase_ == 4) { + return passwordBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder setPassword(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow value) { + if (passwordBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flow_ = value; + onChanged(); + } else { + passwordBuilder_.setMessage(value); + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder setPassword( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder builderForValue) { + if (passwordBuilder_ == null) { + flow_ = builderForValue.build(); + onChanged(); + } else { + passwordBuilder_.setMessage(builderForValue.build()); + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder mergePassword(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow value) { + if (passwordBuilder_ == null) { + if (flowCase_ == 4 && + flow_ != org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance()) { + flow_ = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder((org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_) + .mergeFrom(value).buildPartial(); + } else { + flow_ = value; + } + onChanged(); + } else { + if (flowCase_ == 4) { + passwordBuilder_.mergeFrom(value); + } else { + passwordBuilder_.setMessage(value); + } + } + flowCase_ = 4; + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public Builder clearPassword() { + if (passwordBuilder_ == null) { + if (flowCase_ == 4) { + flowCase_ = 0; + flow_ = null; + onChanged(); + } + } else { + if (flowCase_ == 4) { + flowCase_ = 0; + flow_ = null; + } + passwordBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder getPasswordBuilder() { + return internalGetPasswordFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder() { + if ((flowCase_ == 4) && (passwordBuilder_ != null)) { + return passwordBuilder_.getMessageOrBuilder(); + } else { + if (flowCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_; + } + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + } + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder> + internalGetPasswordFieldBuilder() { + if (passwordBuilder_ == null) { + if (!(flowCase_ == 4)) { + flow_ = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + passwordBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) flow_, + getParentForChildren(), + isClean()); + flow_ = null; + } + flowCase_ = 4; + onChanged(); + return passwordBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OAuthFlows) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OAuthFlows) + private static final org.a2aproject.sdk.compat03.grpc.OAuthFlows DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OAuthFlows(); + } + + public static org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OAuthFlows parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuthFlows getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java new file mode 100644 index 000000000..1e14dbf55 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OAuthFlowsOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OAuthFlowsOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OAuthFlows) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return Whether the authorizationCode field is set. + */ + boolean hasAuthorizationCode(); + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + * @return The authorizationCode. + */ + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow getAuthorizationCode(); + /** + * .a2a.v1.AuthorizationCodeOAuthFlow authorization_code = 1; + */ + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlowOrBuilder getAuthorizationCodeOrBuilder(); + + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return Whether the clientCredentials field is set. + */ + boolean hasClientCredentials(); + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + * @return The clientCredentials. + */ + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow getClientCredentials(); + /** + * .a2a.v1.ClientCredentialsOAuthFlow client_credentials = 2; + */ + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlowOrBuilder getClientCredentialsOrBuilder(); + + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return Whether the implicit field is set. + */ + boolean hasImplicit(); + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + * @return The implicit. + */ + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow getImplicit(); + /** + * .a2a.v1.ImplicitOAuthFlow implicit = 3; + */ + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlowOrBuilder getImplicitOrBuilder(); + + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return Whether the password field is set. + */ + boolean hasPassword(); + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + * @return The password. + */ + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getPassword(); + /** + * .a2a.v1.PasswordOAuthFlow password = 4; + */ + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder getPasswordOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.OAuthFlows.FlowCase getFlowCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java new file mode 100644 index 000000000..322047bea --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecurityScheme.java @@ -0,0 +1,701 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.OpenIdConnectSecurityScheme} + */ +@com.google.protobuf.Generated +public final class OpenIdConnectSecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.OpenIdConnectSecurityScheme) + OpenIdConnectSecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "OpenIdConnectSecurityScheme"); + } + // Use OpenIdConnectSecurityScheme.newBuilder() to construct. + private OpenIdConnectSecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private OpenIdConnectSecurityScheme() { + description_ = ""; + openIdConnectUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder.class); + } + + public static final int DESCRIPTION_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object description_ = ""; + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + @java.lang.Override + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } + } + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int OPEN_ID_CONNECT_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object openIdConnectUrl_ = ""; + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + @java.lang.Override + public java.lang.String getOpenIdConnectUrl() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + openIdConnectUrl_ = s; + return s; + } + } + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getOpenIdConnectUrlBytes() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + openIdConnectUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(openIdConnectUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, openIdConnectUrl_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(description_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, description_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(openIdConnectUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, openIdConnectUrl_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme other = (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) obj; + + if (!getDescription() + .equals(other.getDescription())) return false; + if (!getOpenIdConnectUrl() + .equals(other.getOpenIdConnectUrl())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + hash = (37 * hash) + OPEN_ID_CONNECT_URL_FIELD_NUMBER; + hash = (53 * hash) + getOpenIdConnectUrl().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.OpenIdConnectSecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.OpenIdConnectSecurityScheme) + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.class, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + description_ = ""; + openIdConnectUrl_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_OpenIdConnectSecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result = new org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.description_ = description_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.openIdConnectUrl_ = openIdConnectUrl_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance()) return this; + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getOpenIdConnectUrl().isEmpty()) { + openIdConnectUrl_ = other.openIdConnectUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + description_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + openIdConnectUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object description_ = ""; + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return The bytes for description. + */ + public com.google.protobuf.ByteString + getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @return This builder for chaining. + */ + public Builder clearDescription() { + description_ = getDefaultInstance().getDescription(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Description of this security scheme.
+     * 
+ * + * string description = 1; + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + description_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object openIdConnectUrl_ = ""; + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + public java.lang.String getOpenIdConnectUrl() { + java.lang.Object ref = openIdConnectUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + openIdConnectUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + public com.google.protobuf.ByteString + getOpenIdConnectUrlBytes() { + java.lang.Object ref = openIdConnectUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + openIdConnectUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @param value The openIdConnectUrl to set. + * @return This builder for chaining. + */ + public Builder setOpenIdConnectUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + openIdConnectUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @return This builder for chaining. + */ + public Builder clearOpenIdConnectUrl() { + openIdConnectUrl_ = getDefaultInstance().getOpenIdConnectUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+     * metadata.
+     * 
+ * + * string open_id_connect_url = 2; + * @param value The bytes for openIdConnectUrl to set. + * @return This builder for chaining. + */ + public Builder setOpenIdConnectUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + openIdConnectUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.OpenIdConnectSecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.OpenIdConnectSecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OpenIdConnectSecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java new file mode 100644 index 000000000..1f9237cad --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/OpenIdConnectSecuritySchemeOrBuilder.java @@ -0,0 +1,54 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface OpenIdConnectSecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.OpenIdConnectSecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The description. + */ + java.lang.String getDescription(); + /** + *
+   * Description of this security scheme.
+   * 
+ * + * string description = 1; + * @return The bytes for description. + */ + com.google.protobuf.ByteString + getDescriptionBytes(); + + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The openIdConnectUrl. + */ + java.lang.String getOpenIdConnectUrl(); + /** + *
+   * Well-known URL to discover the [[OpenID-Connect-Discovery]] provider
+   * metadata.
+   * 
+ * + * string open_id_connect_url = 2; + * @return The bytes for openIdConnectUrl. + */ + com.google.protobuf.ByteString + getOpenIdConnectUrlBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java new file mode 100644 index 000000000..1672d8d29 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Part.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Part represents a container for a section of communication content.
+ * Parts can be purely textual, some sort of file (image, video, etc) or
+ * a structured data blob (i.e. JSON).
+ * 
+ * + * Protobuf type {@code a2a.v1.Part} + */ +@com.google.protobuf.Generated +public final class Part extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Part) + PartOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Part"); + } + // Use Part.newBuilder() to construct. + private Part(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Part() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Part_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Part.class, org.a2aproject.sdk.compat03.grpc.Part.Builder.class); + } + + private int partCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object part_; + public enum PartCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TEXT(1), + FILE(2), + DATA(3), + PART_NOT_SET(0); + private final int value; + private PartCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PartCase valueOf(int value) { + return forNumber(value); + } + + public static PartCase forNumber(int value) { + switch (value) { + case 1: return TEXT; + case 2: return FILE; + case 3: return DATA; + case 0: return PART_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PartCase + getPartCase() { + return PartCase.forNumber( + partCase_); + } + + public static final int TEXT_FIELD_NUMBER = 1; + /** + * string text = 1; + * @return Whether the text field is set. + */ + public boolean hasText() { + return partCase_ == 1; + } + /** + * string text = 1; + * @return The text. + */ + public java.lang.String getText() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (partCase_ == 1) { + part_ = s; + } + return s; + } + } + /** + * string text = 1; + * @return The bytes for text. + */ + public com.google.protobuf.ByteString + getTextBytes() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (partCase_ == 1) { + part_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILE_FIELD_NUMBER = 2; + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return partCase_ == 2; + } + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getFile() { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + /** + * .a2a.v1.FilePart file = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder() { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + + public static final int DATA_FIELD_NUMBER = 3; + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return partCase_ == 3; + } + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getData() { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + /** + * .a2a.v1.DataPart data = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder() { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (partCase_ == 1) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, part_); + } + if (partCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.FilePart) part_); + } + if (partCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.DataPart) part_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (partCase_ == 1) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, part_); + } + if (partCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.FilePart) part_); + } + if (partCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.DataPart) part_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Part)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Part other = (org.a2aproject.sdk.compat03.grpc.Part) obj; + + if (!getPartCase().equals(other.getPartCase())) return false; + switch (partCase_) { + case 1: + if (!getText() + .equals(other.getText())) return false; + break; + case 2: + if (!getFile() + .equals(other.getFile())) return false; + break; + case 3: + if (!getData() + .equals(other.getData())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (partCase_) { + case 1: + hash = (37 * hash) + TEXT_FIELD_NUMBER; + hash = (53 * hash) + getText().hashCode(); + break; + case 2: + hash = (37 * hash) + FILE_FIELD_NUMBER; + hash = (53 * hash) + getFile().hashCode(); + break; + case 3: + hash = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getData().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Part parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Part parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Part prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Part represents a container for a section of communication content.
+   * Parts can be purely textual, some sort of file (image, video, etc) or
+   * a structured data blob (i.e. JSON).
+   * 
+ * + * Protobuf type {@code a2a.v1.Part} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Part) + org.a2aproject.sdk.compat03.grpc.PartOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Part_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Part.class, org.a2aproject.sdk.compat03.grpc.Part.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Part.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (fileBuilder_ != null) { + fileBuilder_.clear(); + } + if (dataBuilder_ != null) { + dataBuilder_.clear(); + } + partCase_ = 0; + part_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Part_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part build() { + org.a2aproject.sdk.compat03.grpc.Part result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part buildPartial() { + org.a2aproject.sdk.compat03.grpc.Part result = new org.a2aproject.sdk.compat03.grpc.Part(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Part result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.Part result) { + result.partCase_ = partCase_; + result.part_ = this.part_; + if (partCase_ == 2 && + fileBuilder_ != null) { + result.part_ = fileBuilder_.build(); + } + if (partCase_ == 3 && + dataBuilder_ != null) { + result.part_ = dataBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Part) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Part)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Part other) { + if (other == org.a2aproject.sdk.compat03.grpc.Part.getDefaultInstance()) return this; + switch (other.getPartCase()) { + case TEXT: { + partCase_ = 1; + part_ = other.part_; + onChanged(); + break; + } + case FILE: { + mergeFile(other.getFile()); + break; + } + case DATA: { + mergeData(other.getData()); + break; + } + case PART_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + partCase_ = 1; + part_ = s; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetFileFieldBuilder().getBuilder(), + extensionRegistry); + partCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetDataFieldBuilder().getBuilder(), + extensionRegistry); + partCase_ = 3; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int partCase_ = 0; + private java.lang.Object part_; + public PartCase + getPartCase() { + return PartCase.forNumber( + partCase_); + } + + public Builder clearPart() { + partCase_ = 0; + part_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * string text = 1; + * @return Whether the text field is set. + */ + @java.lang.Override + public boolean hasText() { + return partCase_ == 1; + } + /** + * string text = 1; + * @return The text. + */ + @java.lang.Override + public java.lang.String getText() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (partCase_ == 1) { + part_ = s; + } + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string text = 1; + * @return The bytes for text. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTextBytes() { + java.lang.Object ref = ""; + if (partCase_ == 1) { + ref = part_; + } + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + if (partCase_ == 1) { + part_ = b; + } + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string text = 1; + * @param value The text to set. + * @return This builder for chaining. + */ + public Builder setText( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + partCase_ = 1; + part_ = value; + onChanged(); + return this; + } + /** + * string text = 1; + * @return This builder for chaining. + */ + public Builder clearText() { + if (partCase_ == 1) { + partCase_ = 0; + part_ = null; + onChanged(); + } + return this; + } + /** + * string text = 1; + * @param value The bytes for text to set. + * @return This builder for chaining. + */ + public Builder setTextBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + partCase_ = 1; + part_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder> fileBuilder_; + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + @java.lang.Override + public boolean hasFile() { + return partCase_ == 2; + } + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePart getFile() { + if (fileBuilder_ == null) { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } else { + if (partCase_ == 2) { + return fileBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder setFile(org.a2aproject.sdk.compat03.grpc.FilePart value) { + if (fileBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + part_ = value; + onChanged(); + } else { + fileBuilder_.setMessage(value); + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder setFile( + org.a2aproject.sdk.compat03.grpc.FilePart.Builder builderForValue) { + if (fileBuilder_ == null) { + part_ = builderForValue.build(); + onChanged(); + } else { + fileBuilder_.setMessage(builderForValue.build()); + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder mergeFile(org.a2aproject.sdk.compat03.grpc.FilePart value) { + if (fileBuilder_ == null) { + if (partCase_ == 2 && + part_ != org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance()) { + part_ = org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder((org.a2aproject.sdk.compat03.grpc.FilePart) part_) + .mergeFrom(value).buildPartial(); + } else { + part_ = value; + } + onChanged(); + } else { + if (partCase_ == 2) { + fileBuilder_.mergeFrom(value); + } else { + fileBuilder_.setMessage(value); + } + } + partCase_ = 2; + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public Builder clearFile() { + if (fileBuilder_ == null) { + if (partCase_ == 2) { + partCase_ = 0; + part_ = null; + onChanged(); + } + } else { + if (partCase_ == 2) { + partCase_ = 0; + part_ = null; + } + fileBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.FilePart file = 2; + */ + public org.a2aproject.sdk.compat03.grpc.FilePart.Builder getFileBuilder() { + return internalGetFileFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.FilePart file = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder() { + if ((partCase_ == 2) && (fileBuilder_ != null)) { + return fileBuilder_.getMessageOrBuilder(); + } else { + if (partCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.FilePart) part_; + } + return org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + } + /** + * .a2a.v1.FilePart file = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder> + internalGetFileFieldBuilder() { + if (fileBuilder_ == null) { + if (!(partCase_ == 2)) { + part_ = org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(); + } + fileBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.FilePart, org.a2aproject.sdk.compat03.grpc.FilePart.Builder, org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.FilePart) part_, + getParentForChildren(), + isClean()); + part_ = null; + } + partCase_ = 2; + onChanged(); + return fileBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder> dataBuilder_; + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + @java.lang.Override + public boolean hasData() { + return partCase_ == 3; + } + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPart getData() { + if (dataBuilder_ == null) { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } else { + if (partCase_ == 3) { + return dataBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder setData(org.a2aproject.sdk.compat03.grpc.DataPart value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + part_ = value; + onChanged(); + } else { + dataBuilder_.setMessage(value); + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder setData( + org.a2aproject.sdk.compat03.grpc.DataPart.Builder builderForValue) { + if (dataBuilder_ == null) { + part_ = builderForValue.build(); + onChanged(); + } else { + dataBuilder_.setMessage(builderForValue.build()); + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder mergeData(org.a2aproject.sdk.compat03.grpc.DataPart value) { + if (dataBuilder_ == null) { + if (partCase_ == 3 && + part_ != org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance()) { + part_ = org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder((org.a2aproject.sdk.compat03.grpc.DataPart) part_) + .mergeFrom(value).buildPartial(); + } else { + part_ = value; + } + onChanged(); + } else { + if (partCase_ == 3) { + dataBuilder_.mergeFrom(value); + } else { + dataBuilder_.setMessage(value); + } + } + partCase_ = 3; + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public Builder clearData() { + if (dataBuilder_ == null) { + if (partCase_ == 3) { + partCase_ = 0; + part_ = null; + onChanged(); + } + } else { + if (partCase_ == 3) { + partCase_ = 0; + part_ = null; + } + dataBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.DataPart data = 3; + */ + public org.a2aproject.sdk.compat03.grpc.DataPart.Builder getDataBuilder() { + return internalGetDataFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.DataPart data = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder() { + if ((partCase_ == 3) && (dataBuilder_ != null)) { + return dataBuilder_.getMessageOrBuilder(); + } else { + if (partCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.DataPart) part_; + } + return org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + } + /** + * .a2a.v1.DataPart data = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder> + internalGetDataFieldBuilder() { + if (dataBuilder_ == null) { + if (!(partCase_ == 3)) { + part_ = org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(); + } + dataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.DataPart, org.a2aproject.sdk.compat03.grpc.DataPart.Builder, org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.DataPart) part_, + getParentForChildren(), + isClean()); + part_ = null; + } + partCase_ = 3; + onChanged(); + return dataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Part) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Part) + private static final org.a2aproject.sdk.compat03.grpc.Part DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Part(); + } + + public static org.a2aproject.sdk.compat03.grpc.Part getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Part parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Part getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java new file mode 100644 index 000000000..90b0075d5 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PartOrBuilder.java @@ -0,0 +1,61 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PartOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Part) + com.google.protobuf.MessageOrBuilder { + + /** + * string text = 1; + * @return Whether the text field is set. + */ + boolean hasText(); + /** + * string text = 1; + * @return The text. + */ + java.lang.String getText(); + /** + * string text = 1; + * @return The bytes for text. + */ + com.google.protobuf.ByteString + getTextBytes(); + + /** + * .a2a.v1.FilePart file = 2; + * @return Whether the file field is set. + */ + boolean hasFile(); + /** + * .a2a.v1.FilePart file = 2; + * @return The file. + */ + org.a2aproject.sdk.compat03.grpc.FilePart getFile(); + /** + * .a2a.v1.FilePart file = 2; + */ + org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder getFileOrBuilder(); + + /** + * .a2a.v1.DataPart data = 3; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .a2a.v1.DataPart data = 3; + * @return The data. + */ + org.a2aproject.sdk.compat03.grpc.DataPart getData(); + /** + * .a2a.v1.DataPart data = 3; + */ + org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder getDataOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.Part.PartCase getPartCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java new file mode 100644 index 000000000..4dafb3fa8 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlow.java @@ -0,0 +1,1042 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.PasswordOAuthFlow} + */ +@com.google.protobuf.Generated +public final class PasswordOAuthFlow extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.PasswordOAuthFlow) + PasswordOAuthFlowOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "PasswordOAuthFlow"); + } + // Use PasswordOAuthFlow.newBuilder() to construct. + private PasswordOAuthFlow(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private PasswordOAuthFlow() { + tokenUrl_ = ""; + refreshUrl_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder.class); + } + + public static final int TOKEN_URL_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object tokenUrl_ = ""; + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + @java.lang.Override + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } + } + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REFRESH_URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object refreshUrl_ = ""; + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + @java.lang.Override + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } + } + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCOPES_FIELD_NUMBER = 3; + private static final class ScopesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, java.lang.String> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_ScopesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, refreshUrl_); + } + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetScopes(), + ScopesDefaultEntryHolder.defaultEntry, + 3); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(tokenUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, tokenUrl_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(refreshUrl_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, refreshUrl_); + } + for (java.util.Map.Entry entry + : internalGetScopes().getMap().entrySet()) { + com.google.protobuf.MapEntry + scopes__ = ScopesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, scopes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow other = (org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) obj; + + if (!getTokenUrl() + .equals(other.getTokenUrl())) return false; + if (!getRefreshUrl() + .equals(other.getRefreshUrl())) return false; + if (!internalGetScopes().equals( + other.internalGetScopes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TOKEN_URL_FIELD_NUMBER; + hash = (53 * hash) + getTokenUrl().hashCode(); + hash = (37 * hash) + REFRESH_URL_FIELD_NUMBER; + hash = (53 * hash) + getRefreshUrl().hashCode(); + if (!internalGetScopes().getMap().isEmpty()) { + hash = (37 * hash) + SCOPES_FIELD_NUMBER; + hash = (53 * hash) + internalGetScopes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.PasswordOAuthFlow} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.PasswordOAuthFlow) + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlowOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 3: + return internalGetMutableScopes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.class, org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + tokenUrl_ = ""; + refreshUrl_ = ""; + internalGetMutableScopes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PasswordOAuthFlow_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow build() { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow buildPartial() { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result = new org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.tokenUrl_ = tokenUrl_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.refreshUrl_ = refreshUrl_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.scopes_ = internalGetScopes(); + result.scopes_.makeImmutable(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow other) { + if (other == org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.getDefaultInstance()) return this; + if (!other.getTokenUrl().isEmpty()) { + tokenUrl_ = other.tokenUrl_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getRefreshUrl().isEmpty()) { + refreshUrl_ = other.refreshUrl_; + bitField0_ |= 0x00000002; + onChanged(); + } + internalGetMutableScopes().mergeFrom( + other.internalGetScopes()); + bitField0_ |= 0x00000004; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + tokenUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + refreshUrl_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + com.google.protobuf.MapEntry + scopes__ = input.readMessage( + ScopesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableScopes().getMutableMap().put( + scopes__.getKey(), scopes__.getValue()); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object tokenUrl_ = ""; + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + public java.lang.String getTokenUrl() { + java.lang.Object ref = tokenUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + tokenUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + public com.google.protobuf.ByteString + getTokenUrlBytes() { + java.lang.Object ref = tokenUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + tokenUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @return This builder for chaining. + */ + public Builder clearTokenUrl() { + tokenUrl_ = getDefaultInstance().getTokenUrl(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The token URL to be used for this flow. This MUST be in the form of a URL.
+     * The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string token_url = 1; + * @param value The bytes for tokenUrl to set. + * @return This builder for chaining. + */ + public Builder setTokenUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + tokenUrl_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object refreshUrl_ = ""; + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + public java.lang.String getRefreshUrl() { + java.lang.Object ref = refreshUrl_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + refreshUrl_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + public com.google.protobuf.ByteString + getRefreshUrlBytes() { + java.lang.Object ref = refreshUrl_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + refreshUrl_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @return This builder for chaining. + */ + public Builder clearRefreshUrl() { + refreshUrl_ = getDefaultInstance().getRefreshUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The URL to be used for obtaining refresh tokens. This MUST be in the
+     * form of a URL. The OAuth2 standard requires the use of TLS.
+     * 
+ * + * string refresh_url = 2; + * @param value The bytes for refreshUrl to set. + * @return This builder for chaining. + */ + public Builder setRefreshUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + refreshUrl_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.MapField< + java.lang.String, java.lang.String> scopes_; + private com.google.protobuf.MapField + internalGetScopes() { + if (scopes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + return scopes_; + } + private com.google.protobuf.MapField + internalGetMutableScopes() { + if (scopes_ == null) { + scopes_ = com.google.protobuf.MapField.newMapField( + ScopesDefaultEntryHolder.defaultEntry); + } + if (!scopes_.isMutable()) { + scopes_ = scopes_.copy(); + } + bitField0_ |= 0x00000004; + onChanged(); + return scopes_; + } + public int getScopesCount() { + return internalGetScopes().getMap().size(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public boolean containsScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetScopes().getMap().containsKey(key); + } + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getScopes() { + return getScopesMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.util.Map getScopesMap() { + return internalGetScopes().getMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + @java.lang.Override + public java.lang.String getScopesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetScopes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + public Builder clearScopes() { + bitField0_ = (bitField0_ & ~0x00000004); + internalGetMutableScopes().getMutableMap() + .clear(); + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder removeScopes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableScopes().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableScopes() { + bitField0_ |= 0x00000004; + return internalGetMutableScopes().getMutableMap(); + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putScopes( + java.lang.String key, + java.lang.String value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableScopes().getMutableMap() + .put(key, value); + bitField0_ |= 0x00000004; + return this; + } + /** + *
+     * The available scopes for the OAuth2 security scheme. A map between the
+     * scope name and a short description for it. The map MAY be empty.
+     * 
+ * + * map<string, string> scopes = 3; + */ + public Builder putAllScopes( + java.util.Map values) { + internalGetMutableScopes().getMutableMap() + .putAll(values); + bitField0_ |= 0x00000004; + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.PasswordOAuthFlow) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.PasswordOAuthFlow) + private static final org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow(); + } + + public static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PasswordOAuthFlow parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java new file mode 100644 index 000000000..ec5a79ac1 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PasswordOAuthFlowOrBuilder.java @@ -0,0 +1,115 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PasswordOAuthFlowOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.PasswordOAuthFlow) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The tokenUrl. + */ + java.lang.String getTokenUrl(); + /** + *
+   * The token URL to be used for this flow. This MUST be in the form of a URL.
+   * The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string token_url = 1; + * @return The bytes for tokenUrl. + */ + com.google.protobuf.ByteString + getTokenUrlBytes(); + + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The refreshUrl. + */ + java.lang.String getRefreshUrl(); + /** + *
+   * The URL to be used for obtaining refresh tokens. This MUST be in the
+   * form of a URL. The OAuth2 standard requires the use of TLS.
+   * 
+ * + * string refresh_url = 2; + * @return The bytes for refreshUrl. + */ + com.google.protobuf.ByteString + getRefreshUrlBytes(); + + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + int getScopesCount(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + boolean containsScopes( + java.lang.String key); + /** + * Use {@link #getScopesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getScopes(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.util.Map + getScopesMap(); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + /* nullable */ +java.lang.String getScopesOrDefault( + java.lang.String key, + /* nullable */ +java.lang.String defaultValue); + /** + *
+   * The available scopes for the OAuth2 security scheme. A map between the
+   * scope name and a short description for it. The map MAY be empty.
+   * 
+ * + * map<string, string> scopes = 3; + */ + java.lang.String getScopesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java new file mode 100644 index 000000000..b50742e29 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfig.java @@ -0,0 +1,1107 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Configuration for setting up push notifications for task updates.
+ * 
+ * + * Protobuf type {@code a2a.v1.PushNotificationConfig} + */ +@com.google.protobuf.Generated +public final class PushNotificationConfig extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.PushNotificationConfig) + PushNotificationConfigOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "PushNotificationConfig"); + } + // Use PushNotificationConfig.newBuilder() to construct. + private PushNotificationConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private PushNotificationConfig() { + id_ = ""; + url_ = ""; + token_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder.class); + } + + private int bitField0_; + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URL_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object url_ = ""; + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The url. + */ + @java.lang.Override + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The bytes for url. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOKEN_FIELD_NUMBER = 3; + @SuppressWarnings("serial") + private volatile java.lang.Object token_ = ""; + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The token. + */ + @java.lang.Override + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } + } + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The bytes for token. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int AUTHENTICATION_FIELD_NUMBER = 4; + private org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authentication_; + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + @java.lang.Override + public boolean hasAuthentication() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication() { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder() { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(token_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 3, token_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getAuthentication()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(url_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, url_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(token_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(3, token_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getAuthentication()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.PushNotificationConfig)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig other = (org.a2aproject.sdk.compat03.grpc.PushNotificationConfig) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getUrl() + .equals(other.getUrl())) return false; + if (!getToken() + .equals(other.getToken())) return false; + if (hasAuthentication() != other.hasAuthentication()) return false; + if (hasAuthentication()) { + if (!getAuthentication() + .equals(other.getAuthentication())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getToken().hashCode(); + if (hasAuthentication()) { + hash = (37 * hash) + AUTHENTICATION_FIELD_NUMBER; + hash = (53 * hash) + getAuthentication().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Configuration for setting up push notifications for task updates.
+   * 
+ * + * Protobuf type {@code a2a.v1.PushNotificationConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.PushNotificationConfig) + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetAuthenticationFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + url_ = ""; + token_ = ""; + authentication_ = null; + if (authenticationBuilder_ != null) { + authenticationBuilder_.dispose(); + authenticationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_PushNotificationConfig_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig build() { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig buildPartial() { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result = new org.a2aproject.sdk.compat03.grpc.PushNotificationConfig(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.url_ = url_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.token_ = token_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.authentication_ = authenticationBuilder_ == null + ? authentication_ + : authenticationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.PushNotificationConfig) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.PushNotificationConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig other) { + if (other == org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getToken().isEmpty()) { + token_ = other.token_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.hasAuthentication()) { + mergeAuthentication(other.getAuthentication()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + url_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + token_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetAuthenticationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * A unique id for this push notification.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object url_ = ""; + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return The url. + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return The bytes for url. + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @param value The url to set. + * @return This builder for chaining. + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + url_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @return This builder for chaining. + */ + public Builder clearUrl() { + url_ = getDefaultInstance().getUrl(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Url to send the notification too
+     * 
+ * + * string url = 2; + * @param value The bytes for url to set. + * @return This builder for chaining. + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + url_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object token_ = ""; + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return The token. + */ + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return The bytes for token. + */ + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @param value The token to set. + * @return This builder for chaining. + */ + public Builder setToken( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + token_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @return This builder for chaining. + */ + public Builder clearToken() { + token_ = getDefaultInstance().getToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + *
+     * Token unique for this task/session
+     * 
+ * + * string token = 3; + * @param value The bytes for token to set. + * @return This builder for chaining. + */ + public Builder setTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + token_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authentication_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder> authenticationBuilder_; + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + public boolean hasAuthentication() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication() { + if (authenticationBuilder_ == null) { + return authentication_ == null ? org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } else { + return authenticationBuilder_.getMessage(); + } + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder setAuthentication(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo value) { + if (authenticationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + authentication_ = value; + } else { + authenticationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder setAuthentication( + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder builderForValue) { + if (authenticationBuilder_ == null) { + authentication_ = builderForValue.build(); + } else { + authenticationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder mergeAuthentication(org.a2aproject.sdk.compat03.grpc.AuthenticationInfo value) { + if (authenticationBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && + authentication_ != null && + authentication_ != org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance()) { + getAuthenticationBuilder().mergeFrom(value); + } else { + authentication_ = value; + } + } else { + authenticationBuilder_.mergeFrom(value); + } + if (authentication_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public Builder clearAuthentication() { + bitField0_ = (bitField0_ & ~0x00000008); + authentication_ = null; + if (authenticationBuilder_ != null) { + authenticationBuilder_.dispose(); + authenticationBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder getAuthenticationBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return internalGetAuthenticationFieldBuilder().getBuilder(); + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + public org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder() { + if (authenticationBuilder_ != null) { + return authenticationBuilder_.getMessageOrBuilder(); + } else { + return authentication_ == null ? + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.getDefaultInstance() : authentication_; + } + } + /** + *
+     * Information about the authentication to sent with the notification
+     * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder> + internalGetAuthenticationFieldBuilder() { + if (authenticationBuilder_ == null) { + authenticationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo, org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder, org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder>( + getAuthentication(), + getParentForChildren(), + isClean()); + authentication_ = null; + } + return authenticationBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.PushNotificationConfig) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.PushNotificationConfig) + private static final org.a2aproject.sdk.compat03.grpc.PushNotificationConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.PushNotificationConfig(); + } + + public static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PushNotificationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java new file mode 100644 index 000000000..a8990646f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/PushNotificationConfigOrBuilder.java @@ -0,0 +1,99 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface PushNotificationConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.PushNotificationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * A unique id for this push notification.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The url. + */ + java.lang.String getUrl(); + /** + *
+   * Url to send the notification too
+   * 
+ * + * string url = 2; + * @return The bytes for url. + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The token. + */ + java.lang.String getToken(); + /** + *
+   * Token unique for this task/session
+   * 
+ * + * string token = 3; + * @return The bytes for token. + */ + com.google.protobuf.ByteString + getTokenBytes(); + + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return Whether the authentication field is set. + */ + boolean hasAuthentication(); + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + * @return The authentication. + */ + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo getAuthentication(); + /** + *
+   * Information about the authentication to sent with the notification
+   * 
+ * + * .a2a.v1.AuthenticationInfo authentication = 4; + */ + org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder getAuthenticationOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java new file mode 100644 index 000000000..febb428cb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Role.java @@ -0,0 +1,150 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf enum {@code a2a.v1.Role} + */ +@com.google.protobuf.Generated +public enum Role + implements com.google.protobuf.ProtocolMessageEnum { + /** + * ROLE_UNSPECIFIED = 0; + */ + ROLE_UNSPECIFIED(0), + /** + *
+   * USER role refers to communication from the client to the server.
+   * 
+ * + * ROLE_USER = 1; + */ + ROLE_USER(1), + /** + *
+   * AGENT role refers to communication from the server to the client.
+   * 
+ * + * ROLE_AGENT = 2; + */ + ROLE_AGENT(2), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Role"); + } + /** + * ROLE_UNSPECIFIED = 0; + */ + public static final int ROLE_UNSPECIFIED_VALUE = 0; + /** + *
+   * USER role refers to communication from the client to the server.
+   * 
+ * + * ROLE_USER = 1; + */ + public static final int ROLE_USER_VALUE = 1; + /** + *
+   * AGENT role refers to communication from the server to the client.
+   * 
+ * + * ROLE_AGENT = 2; + */ + public static final int ROLE_AGENT_VALUE = 2; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Role valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Role forNumber(int value) { + switch (value) { + case 0: return ROLE_UNSPECIFIED; + case 1: return ROLE_USER; + case 2: return ROLE_AGENT; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + Role> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Role findValueByNumber(int number) { + return Role.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.getDescriptor().getEnumTypes().get(1); + } + + private static final Role[] VALUES = values(); + + public static Role valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Role(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:a2a.v1.Role) +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java new file mode 100644 index 000000000..67e4a464e --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Security.java @@ -0,0 +1,672 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.Security} + */ +@com.google.protobuf.Generated +public final class Security extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Security) + SecurityOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Security"); + } + // Use Security.newBuilder() to construct. + private Security(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Security() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Security.class, org.a2aproject.sdk.compat03.grpc.Security.Builder.class); + } + + public static final int SCHEMES_FIELD_NUMBER = 1; + private static final class SchemesDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringList> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_SchemesEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance()); + } + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringList> schemes_; + private com.google.protobuf.MapField + internalGetSchemes() { + if (schemes_ == null) { + return com.google.protobuf.MapField.emptyMapField( + SchemesDefaultEntryHolder.defaultEntry); + } + return schemes_; + } + public int getSchemesCount() { + return internalGetSchemes().getMap().size(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public boolean containsSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSchemes().getMap().containsKey(key); + } + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSchemes() { + return getSchemesMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public java.util.Map getSchemesMap() { + return internalGetSchemes().getMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSchemes().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = + internalGetSchemes().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + com.google.protobuf.GeneratedMessage + .serializeStringMapTo( + output, + internalGetSchemes(), + SchemesDefaultEntryHolder.defaultEntry, + 1); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry + : internalGetSchemes().getMap().entrySet()) { + com.google.protobuf.MapEntry + schemes__ = SchemesDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, schemes__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Security)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Security other = (org.a2aproject.sdk.compat03.grpc.Security) obj; + + if (!internalGetSchemes().equals( + other.internalGetSchemes())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetSchemes().getMap().isEmpty()) { + hash = (37 * hash) + SCHEMES_FIELD_NUMBER; + hash = (53 * hash) + internalGetSchemes().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Security parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Security parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Security prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.Security} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Security) + org.a2aproject.sdk.compat03.grpc.SecurityOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetMutableSchemes(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Security.class, org.a2aproject.sdk.compat03.grpc.Security.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Security.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + internalGetMutableSchemes().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Security_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security build() { + org.a2aproject.sdk.compat03.grpc.Security result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security buildPartial() { + org.a2aproject.sdk.compat03.grpc.Security result = new org.a2aproject.sdk.compat03.grpc.Security(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Security result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.schemes_ = internalGetSchemes().build(SchemesDefaultEntryHolder.defaultEntry); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Security) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Security)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Security other) { + if (other == org.a2aproject.sdk.compat03.grpc.Security.getDefaultInstance()) return this; + internalGetMutableSchemes().mergeFrom( + other.internalGetSchemes()); + bitField0_ |= 0x00000001; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.protobuf.MapEntry + schemes__ = input.readMessage( + SchemesDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + internalGetMutableSchemes().ensureBuilderMap().put( + schemes__.getKey(), schemes__.getValue()); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private static final class SchemesConverter implements com.google.protobuf.MapFieldBuilder.Converter { + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList build(org.a2aproject.sdk.compat03.grpc.StringListOrBuilder val) { + if (val instanceof org.a2aproject.sdk.compat03.grpc.StringList) { return (org.a2aproject.sdk.compat03.grpc.StringList) val; } + return ((org.a2aproject.sdk.compat03.grpc.StringList.Builder) val).build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry defaultEntry() { + return SchemesDefaultEntryHolder.defaultEntry; + } + }; + private static final SchemesConverter schemesConverter = new SchemesConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, org.a2aproject.sdk.compat03.grpc.StringListOrBuilder, org.a2aproject.sdk.compat03.grpc.StringList, org.a2aproject.sdk.compat03.grpc.StringList.Builder> schemes_; + private com.google.protobuf.MapFieldBuilder + internalGetSchemes() { + if (schemes_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(schemesConverter); + } + return schemes_; + } + private com.google.protobuf.MapFieldBuilder + internalGetMutableSchemes() { + if (schemes_ == null) { + schemes_ = new com.google.protobuf.MapFieldBuilder<>(schemesConverter); + } + bitField0_ |= 0x00000001; + onChanged(); + return schemes_; + } + public int getSchemesCount() { + return internalGetSchemes().ensureBuilderMap().size(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public boolean containsSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + return internalGetSchemes().ensureBuilderMap().containsKey(key); + } + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getSchemes() { + return getSchemesMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public java.util.Map getSchemesMap() { + return internalGetSchemes().getImmutableMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSchemes().ensureBuilderMap(); + return map.containsKey(key) ? schemesConverter.build(map.get(key)) : defaultValue; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + java.util.Map map = internalGetMutableSchemes().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return schemesConverter.build(map.get(key)); + } + public Builder clearSchemes() { + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutableSchemes().clear(); + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder removeSchemes( + java.lang.String key) { + if (key == null) { throw new NullPointerException("map key"); } + internalGetMutableSchemes().ensureBuilderMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableSchemes() { + bitField0_ |= 0x00000001; + return internalGetMutableSchemes().ensureMessageMap(); + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder putSchemes( + java.lang.String key, + org.a2aproject.sdk.compat03.grpc.StringList value) { + if (key == null) { throw new NullPointerException("map key"); } + if (value == null) { throw new NullPointerException("map value"); } + internalGetMutableSchemes().ensureBuilderMap() + .put(key, value); + bitField0_ |= 0x00000001; + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public Builder putAllSchemes( + java.util.Map values) { + for (java.util.Map.Entry e : values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableSchemes().ensureBuilderMap() + .putAll(values); + bitField0_ |= 0x00000001; + return this; + } + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + public org.a2aproject.sdk.compat03.grpc.StringList.Builder putSchemesBuilderIfAbsent( + java.lang.String key) { + java.util.Map builderMap = internalGetMutableSchemes().ensureBuilderMap(); + org.a2aproject.sdk.compat03.grpc.StringListOrBuilder entry = builderMap.get(key); + if (entry == null) { + entry = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + builderMap.put(key, entry); + } + if (entry instanceof org.a2aproject.sdk.compat03.grpc.StringList) { + entry = ((org.a2aproject.sdk.compat03.grpc.StringList) entry).toBuilder(); + builderMap.put(key, entry); + } + return (org.a2aproject.sdk.compat03.grpc.StringList.Builder) entry; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Security) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Security) + private static final org.a2aproject.sdk.compat03.grpc.Security DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Security(); + } + + public static org.a2aproject.sdk.compat03.grpc.Security getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Security parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Security getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java new file mode 100644 index 000000000..9c65475cb --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityOrBuilder.java @@ -0,0 +1,46 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SecurityOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Security) + com.google.protobuf.MessageOrBuilder { + + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + int getSchemesCount(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + boolean containsSchemes( + java.lang.String key); + /** + * Use {@link #getSchemesMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getSchemes(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + java.util.Map + getSchemesMap(); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrDefault( + java.lang.String key, + /* nullable */ +org.a2aproject.sdk.compat03.grpc.StringList defaultValue); + /** + * map<string, .a2a.v1.StringList> schemes = 1; + */ + org.a2aproject.sdk.compat03.grpc.StringList getSchemesOrThrow( + java.lang.String key); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java new file mode 100644 index 000000000..25c183b50 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecurityScheme.java @@ -0,0 +1,1481 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.SecurityScheme} + */ +@com.google.protobuf.Generated +public final class SecurityScheme extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SecurityScheme) + SecuritySchemeOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SecurityScheme"); + } + // Use SecurityScheme.newBuilder() to construct. + private SecurityScheme(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SecurityScheme() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder.class); + } + + private int schemeCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object scheme_; + public enum SchemeCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + API_KEY_SECURITY_SCHEME(1), + HTTP_AUTH_SECURITY_SCHEME(2), + OAUTH2_SECURITY_SCHEME(3), + OPEN_ID_CONNECT_SECURITY_SCHEME(4), + MTLS_SECURITY_SCHEME(5), + SCHEME_NOT_SET(0); + private final int value; + private SchemeCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static SchemeCase valueOf(int value) { + return forNumber(value); + } + + public static SchemeCase forNumber(int value) { + switch (value) { + case 1: return API_KEY_SECURITY_SCHEME; + case 2: return HTTP_AUTH_SECURITY_SCHEME; + case 3: return OAUTH2_SECURITY_SCHEME; + case 4: return OPEN_ID_CONNECT_SECURITY_SCHEME; + case 5: return MTLS_SECURITY_SCHEME; + case 0: return SCHEME_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public SchemeCase + getSchemeCase() { + return SchemeCase.forNumber( + schemeCase_); + } + + public static final int API_KEY_SECURITY_SCHEME_FIELD_NUMBER = 1; + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + @java.lang.Override + public boolean hasApiKeySecurityScheme() { + return schemeCase_ == 1; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme() { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder() { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + + public static final int HTTP_AUTH_SECURITY_SCHEME_FIELD_NUMBER = 2; + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasHttpAuthSecurityScheme() { + return schemeCase_ == 2; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme() { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder() { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + + public static final int OAUTH2_SECURITY_SCHEME_FIELD_NUMBER = 3; + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOauth2SecurityScheme() { + return schemeCase_ == 3; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme() { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder() { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + + public static final int OPEN_ID_CONNECT_SECURITY_SCHEME_FIELD_NUMBER = 4; + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOpenIdConnectSecurityScheme() { + return schemeCase_ == 4; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme() { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder() { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + + public static final int MTLS_SECURITY_SCHEME_FIELD_NUMBER = 5; + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasMtlsSecurityScheme() { + return schemeCase_ == 5; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme() { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder() { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (schemeCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_); + } + if (schemeCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_); + } + if (schemeCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_); + } + if (schemeCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_); + } + if (schemeCase_ == 5) { + output.writeMessage(5, (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (schemeCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_); + } + if (schemeCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_); + } + if (schemeCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_); + } + if (schemeCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_); + } + if (schemeCase_ == 5) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SecurityScheme other = (org.a2aproject.sdk.compat03.grpc.SecurityScheme) obj; + + if (!getSchemeCase().equals(other.getSchemeCase())) return false; + switch (schemeCase_) { + case 1: + if (!getApiKeySecurityScheme() + .equals(other.getApiKeySecurityScheme())) return false; + break; + case 2: + if (!getHttpAuthSecurityScheme() + .equals(other.getHttpAuthSecurityScheme())) return false; + break; + case 3: + if (!getOauth2SecurityScheme() + .equals(other.getOauth2SecurityScheme())) return false; + break; + case 4: + if (!getOpenIdConnectSecurityScheme() + .equals(other.getOpenIdConnectSecurityScheme())) return false; + break; + case 5: + if (!getMtlsSecurityScheme() + .equals(other.getMtlsSecurityScheme())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (schemeCase_) { + case 1: + hash = (37 * hash) + API_KEY_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getApiKeySecurityScheme().hashCode(); + break; + case 2: + hash = (37 * hash) + HTTP_AUTH_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getHttpAuthSecurityScheme().hashCode(); + break; + case 3: + hash = (37 * hash) + OAUTH2_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getOauth2SecurityScheme().hashCode(); + break; + case 4: + hash = (37 * hash) + OPEN_ID_CONNECT_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getOpenIdConnectSecurityScheme().hashCode(); + break; + case 5: + hash = (37 * hash) + MTLS_SECURITY_SCHEME_FIELD_NUMBER; + hash = (53 * hash) + getMtlsSecurityScheme().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SecurityScheme prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.SecurityScheme} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SecurityScheme) + org.a2aproject.sdk.compat03.grpc.SecuritySchemeOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SecurityScheme_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SecurityScheme.class, org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (apiKeySecuritySchemeBuilder_ != null) { + apiKeySecuritySchemeBuilder_.clear(); + } + if (httpAuthSecuritySchemeBuilder_ != null) { + httpAuthSecuritySchemeBuilder_.clear(); + } + if (oauth2SecuritySchemeBuilder_ != null) { + oauth2SecuritySchemeBuilder_.clear(); + } + if (openIdConnectSecuritySchemeBuilder_ != null) { + openIdConnectSecuritySchemeBuilder_.clear(); + } + if (mtlsSecuritySchemeBuilder_ != null) { + mtlsSecuritySchemeBuilder_.clear(); + } + schemeCase_ = 0; + scheme_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SecurityScheme_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme build() { + org.a2aproject.sdk.compat03.grpc.SecurityScheme result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme buildPartial() { + org.a2aproject.sdk.compat03.grpc.SecurityScheme result = new org.a2aproject.sdk.compat03.grpc.SecurityScheme(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SecurityScheme result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.SecurityScheme result) { + result.schemeCase_ = schemeCase_; + result.scheme_ = this.scheme_; + if (schemeCase_ == 1 && + apiKeySecuritySchemeBuilder_ != null) { + result.scheme_ = apiKeySecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 2 && + httpAuthSecuritySchemeBuilder_ != null) { + result.scheme_ = httpAuthSecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 3 && + oauth2SecuritySchemeBuilder_ != null) { + result.scheme_ = oauth2SecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 4 && + openIdConnectSecuritySchemeBuilder_ != null) { + result.scheme_ = openIdConnectSecuritySchemeBuilder_.build(); + } + if (schemeCase_ == 5 && + mtlsSecuritySchemeBuilder_ != null) { + result.scheme_ = mtlsSecuritySchemeBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SecurityScheme) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SecurityScheme)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SecurityScheme other) { + if (other == org.a2aproject.sdk.compat03.grpc.SecurityScheme.getDefaultInstance()) return this; + switch (other.getSchemeCase()) { + case API_KEY_SECURITY_SCHEME: { + mergeApiKeySecurityScheme(other.getApiKeySecurityScheme()); + break; + } + case HTTP_AUTH_SECURITY_SCHEME: { + mergeHttpAuthSecurityScheme(other.getHttpAuthSecurityScheme()); + break; + } + case OAUTH2_SECURITY_SCHEME: { + mergeOauth2SecurityScheme(other.getOauth2SecurityScheme()); + break; + } + case OPEN_ID_CONNECT_SECURITY_SCHEME: { + mergeOpenIdConnectSecurityScheme(other.getOpenIdConnectSecurityScheme()); + break; + } + case MTLS_SECURITY_SCHEME: { + mergeMtlsSecurityScheme(other.getMtlsSecurityScheme()); + break; + } + case SCHEME_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetApiKeySecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetHttpAuthSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetOauth2SecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetOpenIdConnectSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 4; + break; + } // case 34 + case 42: { + input.readMessage( + internalGetMtlsSecuritySchemeFieldBuilder().getBuilder(), + extensionRegistry); + schemeCase_ = 5; + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int schemeCase_ = 0; + private java.lang.Object scheme_; + public SchemeCase + getSchemeCase() { + return SchemeCase.forNumber( + schemeCase_); + } + + public Builder clearScheme() { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder> apiKeySecuritySchemeBuilder_; + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + @java.lang.Override + public boolean hasApiKeySecurityScheme() { + return schemeCase_ == 1; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 1) { + return apiKeySecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder setApiKeySecurityScheme(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme value) { + if (apiKeySecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + apiKeySecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder setApiKeySecurityScheme( + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder builderForValue) { + if (apiKeySecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + apiKeySecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder mergeApiKeySecurityScheme(org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme value) { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1 && + scheme_ != org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 1) { + apiKeySecuritySchemeBuilder_.mergeFrom(value); + } else { + apiKeySecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 1; + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public Builder clearApiKeySecurityScheme() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (schemeCase_ == 1) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 1) { + schemeCase_ = 0; + scheme_ = null; + } + apiKeySecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + public org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder getApiKeySecuritySchemeBuilder() { + return internalGetApiKeySecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder() { + if ((schemeCase_ == 1) && (apiKeySecuritySchemeBuilder_ != null)) { + return apiKeySecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder> + internalGetApiKeySecuritySchemeFieldBuilder() { + if (apiKeySecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 1)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.getDefaultInstance(); + } + apiKeySecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme, org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 1; + onChanged(); + return apiKeySecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder> httpAuthSecuritySchemeBuilder_; + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasHttpAuthSecurityScheme() { + return schemeCase_ == 2; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 2) { + return httpAuthSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder setHttpAuthSecurityScheme(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme value) { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder setHttpAuthSecurityScheme( + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder builderForValue) { + if (httpAuthSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder mergeHttpAuthSecurityScheme(org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme value) { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2 && + scheme_ != org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 2) { + httpAuthSecuritySchemeBuilder_.mergeFrom(value); + } else { + httpAuthSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 2; + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public Builder clearHttpAuthSecurityScheme() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 2) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 2) { + schemeCase_ = 0; + scheme_ = null; + } + httpAuthSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder getHttpAuthSecuritySchemeBuilder() { + return internalGetHttpAuthSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder() { + if ((schemeCase_ == 2) && (httpAuthSecuritySchemeBuilder_ != null)) { + return httpAuthSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder> + internalGetHttpAuthSecuritySchemeFieldBuilder() { + if (httpAuthSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 2)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.getDefaultInstance(); + } + httpAuthSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 2; + onChanged(); + return httpAuthSecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder> oauth2SecuritySchemeBuilder_; + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOauth2SecurityScheme() { + return schemeCase_ == 3; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 3) { + return oauth2SecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder setOauth2SecurityScheme(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme value) { + if (oauth2SecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + oauth2SecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder setOauth2SecurityScheme( + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder builderForValue) { + if (oauth2SecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + oauth2SecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder mergeOauth2SecurityScheme(org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme value) { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3 && + scheme_ != org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 3) { + oauth2SecuritySchemeBuilder_.mergeFrom(value); + } else { + oauth2SecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 3; + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public Builder clearOauth2SecurityScheme() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (schemeCase_ == 3) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 3) { + schemeCase_ = 0; + scheme_ = null; + } + oauth2SecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + public org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder getOauth2SecuritySchemeBuilder() { + return internalGetOauth2SecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder() { + if ((schemeCase_ == 3) && (oauth2SecuritySchemeBuilder_ != null)) { + return oauth2SecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder> + internalGetOauth2SecuritySchemeFieldBuilder() { + if (oauth2SecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 3)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.getDefaultInstance(); + } + oauth2SecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme, org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 3; + onChanged(); + return oauth2SecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder> openIdConnectSecuritySchemeBuilder_; + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasOpenIdConnectSecurityScheme() { + return schemeCase_ == 4; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 4) { + return openIdConnectSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder setOpenIdConnectSecurityScheme(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme value) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder setOpenIdConnectSecurityScheme( + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder builderForValue) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder mergeOpenIdConnectSecurityScheme(org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme value) { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4 && + scheme_ != org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 4) { + openIdConnectSecuritySchemeBuilder_.mergeFrom(value); + } else { + openIdConnectSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 4; + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public Builder clearOpenIdConnectSecurityScheme() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 4) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 4) { + schemeCase_ = 0; + scheme_ = null; + } + openIdConnectSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder getOpenIdConnectSecuritySchemeBuilder() { + return internalGetOpenIdConnectSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder() { + if ((schemeCase_ == 4) && (openIdConnectSecuritySchemeBuilder_ != null)) { + return openIdConnectSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder> + internalGetOpenIdConnectSecuritySchemeFieldBuilder() { + if (openIdConnectSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 4)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.getDefaultInstance(); + } + openIdConnectSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 4; + onChanged(); + return openIdConnectSecuritySchemeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder> mtlsSecuritySchemeBuilder_; + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + @java.lang.Override + public boolean hasMtlsSecurityScheme() { + return schemeCase_ == 5; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } else { + if (schemeCase_ == 5) { + return mtlsSecuritySchemeBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder setMtlsSecurityScheme(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme value) { + if (mtlsSecuritySchemeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + scheme_ = value; + onChanged(); + } else { + mtlsSecuritySchemeBuilder_.setMessage(value); + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder setMtlsSecurityScheme( + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder builderForValue) { + if (mtlsSecuritySchemeBuilder_ == null) { + scheme_ = builderForValue.build(); + onChanged(); + } else { + mtlsSecuritySchemeBuilder_.setMessage(builderForValue.build()); + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder mergeMtlsSecurityScheme(org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme value) { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5 && + scheme_ != org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance()) { + scheme_ = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder((org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_) + .mergeFrom(value).buildPartial(); + } else { + scheme_ = value; + } + onChanged(); + } else { + if (schemeCase_ == 5) { + mtlsSecuritySchemeBuilder_.mergeFrom(value); + } else { + mtlsSecuritySchemeBuilder_.setMessage(value); + } + } + schemeCase_ = 5; + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public Builder clearMtlsSecurityScheme() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (schemeCase_ == 5) { + schemeCase_ = 0; + scheme_ = null; + onChanged(); + } + } else { + if (schemeCase_ == 5) { + schemeCase_ = 0; + scheme_ = null; + } + mtlsSecuritySchemeBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder getMtlsSecuritySchemeBuilder() { + return internalGetMtlsSecuritySchemeFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder() { + if ((schemeCase_ == 5) && (mtlsSecuritySchemeBuilder_ != null)) { + return mtlsSecuritySchemeBuilder_.getMessageOrBuilder(); + } else { + if (schemeCase_ == 5) { + return (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_; + } + return org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + } + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder> + internalGetMtlsSecuritySchemeFieldBuilder() { + if (mtlsSecuritySchemeBuilder_ == null) { + if (!(schemeCase_ == 5)) { + scheme_ = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.getDefaultInstance(); + } + mtlsSecuritySchemeBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme, org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder, org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme) scheme_, + getParentForChildren(), + isClean()); + scheme_ = null; + } + schemeCase_ = 5; + onChanged(); + return mtlsSecuritySchemeBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SecurityScheme) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SecurityScheme) + private static final org.a2aproject.sdk.compat03.grpc.SecurityScheme DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SecurityScheme(); + } + + public static org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SecurityScheme parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SecurityScheme getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java new file mode 100644 index 000000000..d7b60e978 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SecuritySchemeOrBuilder.java @@ -0,0 +1,89 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SecuritySchemeOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SecurityScheme) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return Whether the apiKeySecurityScheme field is set. + */ + boolean hasApiKeySecurityScheme(); + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + * @return The apiKeySecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme getApiKeySecurityScheme(); + /** + * .a2a.v1.APIKeySecurityScheme api_key_security_scheme = 1; + */ + org.a2aproject.sdk.compat03.grpc.APIKeySecuritySchemeOrBuilder getApiKeySecuritySchemeOrBuilder(); + + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return Whether the httpAuthSecurityScheme field is set. + */ + boolean hasHttpAuthSecurityScheme(); + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + * @return The httpAuthSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme getHttpAuthSecurityScheme(); + /** + * .a2a.v1.HTTPAuthSecurityScheme http_auth_security_scheme = 2; + */ + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecuritySchemeOrBuilder getHttpAuthSecuritySchemeOrBuilder(); + + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return Whether the oauth2SecurityScheme field is set. + */ + boolean hasOauth2SecurityScheme(); + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + * @return The oauth2SecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme getOauth2SecurityScheme(); + /** + * .a2a.v1.OAuth2SecurityScheme oauth2_security_scheme = 3; + */ + org.a2aproject.sdk.compat03.grpc.OAuth2SecuritySchemeOrBuilder getOauth2SecuritySchemeOrBuilder(); + + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return Whether the openIdConnectSecurityScheme field is set. + */ + boolean hasOpenIdConnectSecurityScheme(); + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + * @return The openIdConnectSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme getOpenIdConnectSecurityScheme(); + /** + * .a2a.v1.OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + */ + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecuritySchemeOrBuilder getOpenIdConnectSecuritySchemeOrBuilder(); + + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return Whether the mtlsSecurityScheme field is set. + */ + boolean hasMtlsSecurityScheme(); + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + * @return The mtlsSecurityScheme. + */ + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme getMtlsSecurityScheme(); + /** + * .a2a.v1.MutualTlsSecurityScheme mtls_security_scheme = 5; + */ + org.a2aproject.sdk.compat03.grpc.MutualTlsSecuritySchemeOrBuilder getMtlsSecuritySchemeOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.SecurityScheme.SchemeCase getSchemeCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java new file mode 100644 index 000000000..2c1dc46bf --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfiguration.java @@ -0,0 +1,1037 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Configuration of a send message request.
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageConfiguration} + */ +@com.google.protobuf.Generated +public final class SendMessageConfiguration extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageConfiguration) + SendMessageConfigurationOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageConfiguration"); + } + // Use SendMessageConfiguration.newBuilder() to construct. + private SendMessageConfiguration(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageConfiguration() { + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.class, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder.class); + } + + private int bitField0_; + public static final int ACCEPTED_OUTPUT_MODES_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getAcceptedOutputModesList() { + return acceptedOutputModes_; + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + public int getAcceptedOutputModesCount() { + return acceptedOutputModes_.size(); + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + public java.lang.String getAcceptedOutputModes(int index) { + return acceptedOutputModes_.get(index); + } + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index) { + return acceptedOutputModes_.getByteString(index); + } + + public static final int PUSH_NOTIFICATION_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotification_; + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + @java.lang.Override + public boolean hasPushNotification() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification() { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder() { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + + public static final int HISTORY_LENGTH_FIELD_NUMBER = 3; + private int historyLength_ = 0; + /** + *
+   * The maximum number of messages to include in the history. if 0, the
+   * history will be unlimited.
+   * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + + public static final int BLOCKING_FIELD_NUMBER = 4; + private boolean blocking_ = false; + /** + *
+   * If true, the message will be blocking until the task is completed. If
+   * false, the message will be non-blocking and the task will be returned
+   * immediately. It is the caller's responsibility to check for any task
+   * updates.
+   * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + @java.lang.Override + public boolean getBlocking() { + return blocking_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < acceptedOutputModes_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, acceptedOutputModes_.getRaw(i)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getPushNotification()); + } + if (historyLength_ != 0) { + output.writeInt32(3, historyLength_); + } + if (blocking_ != false) { + output.writeBool(4, blocking_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < acceptedOutputModes_.size(); i++) { + dataSize += computeStringSizeNoTag(acceptedOutputModes_.getRaw(i)); + } + size += dataSize; + size += 1 * getAcceptedOutputModesList().size(); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPushNotification()); + } + if (historyLength_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(3, historyLength_); + } + if (blocking_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, blocking_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration other = (org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration) obj; + + if (!getAcceptedOutputModesList() + .equals(other.getAcceptedOutputModesList())) return false; + if (hasPushNotification() != other.hasPushNotification()) return false; + if (hasPushNotification()) { + if (!getPushNotification() + .equals(other.getPushNotification())) return false; + } + if (getHistoryLength() + != other.getHistoryLength()) return false; + if (getBlocking() + != other.getBlocking()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAcceptedOutputModesCount() > 0) { + hash = (37 * hash) + ACCEPTED_OUTPUT_MODES_FIELD_NUMBER; + hash = (53 * hash) + getAcceptedOutputModesList().hashCode(); + } + if (hasPushNotification()) { + hash = (37 * hash) + PUSH_NOTIFICATION_FIELD_NUMBER; + hash = (53 * hash) + getPushNotification().hashCode(); + } + hash = (37 * hash) + HISTORY_LENGTH_FIELD_NUMBER; + hash = (53 * hash) + getHistoryLength(); + hash = (37 * hash) + BLOCKING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getBlocking()); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Configuration of a send message request.
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageConfiguration} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageConfiguration) + org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageConfiguration_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.class, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPushNotificationFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + pushNotification_ = null; + if (pushNotificationBuilder_ != null) { + pushNotificationBuilder_.dispose(); + pushNotificationBuilder_ = null; + } + historyLength_ = 0; + blocking_ = false; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageConfiguration_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration build() { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result = new org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + acceptedOutputModes_.makeImmutable(); + result.acceptedOutputModes_ = acceptedOutputModes_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotification_ = pushNotificationBuilder_ == null + ? pushNotification_ + : pushNotificationBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.historyLength_ = historyLength_; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.blocking_ = blocking_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance()) return this; + if (!other.acceptedOutputModes_.isEmpty()) { + if (acceptedOutputModes_.isEmpty()) { + acceptedOutputModes_ = other.acceptedOutputModes_; + bitField0_ |= 0x00000001; + } else { + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.addAll(other.acceptedOutputModes_); + } + onChanged(); + } + if (other.hasPushNotification()) { + mergePushNotification(other.getPushNotification()); + } + if (other.getHistoryLength() != 0) { + setHistoryLength(other.getHistoryLength()); + } + if (other.getBlocking() != false) { + setBlocking(other.getBlocking()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(s); + break; + } // case 10 + case 18: { + input.readMessage( + internalGetPushNotificationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 24: { + historyLength_ = input.readInt32(); + bitField0_ |= 0x00000004; + break; + } // case 24 + case 32: { + blocking_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureAcceptedOutputModesIsMutable() { + if (!acceptedOutputModes_.isModifiable()) { + acceptedOutputModes_ = new com.google.protobuf.LazyStringArrayList(acceptedOutputModes_); + } + bitField0_ |= 0x00000001; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + public com.google.protobuf.ProtocolStringList + getAcceptedOutputModesList() { + acceptedOutputModes_.makeImmutable(); + return acceptedOutputModes_; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + public int getAcceptedOutputModesCount() { + return acceptedOutputModes_.size(); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + public java.lang.String getAcceptedOutputModes(int index) { + return acceptedOutputModes_.get(index); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + public com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index) { + return acceptedOutputModes_.getByteString(index); + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index to set the value at. + * @param value The acceptedOutputModes to set. + * @return This builder for chaining. + */ + public Builder setAcceptedOutputModes( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param value The acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAcceptedOutputModes( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param values The acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAllAcceptedOutputModes( + java.lang.Iterable values) { + ensureAcceptedOutputModesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, acceptedOutputModes_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @return This builder for chaining. + */ + public Builder clearAcceptedOutputModes() { + acceptedOutputModes_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + *
+     * The output modes that the agent is expected to respond with.
+     * 
+ * + * repeated string accepted_output_modes = 1; + * @param value The bytes of the acceptedOutputModes to add. + * @return This builder for chaining. + */ + public Builder addAcceptedOutputModesBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureAcceptedOutputModesIsMutable(); + acceptedOutputModes_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotification_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> pushNotificationBuilder_; + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + public boolean hasPushNotification() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification() { + if (pushNotificationBuilder_ == null) { + return pushNotification_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } else { + return pushNotificationBuilder_.getMessage(); + } + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder setPushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pushNotification_ = value; + } else { + pushNotificationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder setPushNotification( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builderForValue) { + if (pushNotificationBuilder_ == null) { + pushNotification_ = builderForValue.build(); + } else { + pushNotificationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder mergePushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + pushNotification_ != null && + pushNotification_ != org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) { + getPushNotificationBuilder().mergeFrom(value); + } else { + pushNotification_ = value; + } + } else { + pushNotificationBuilder_.mergeFrom(value); + } + if (pushNotification_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public Builder clearPushNotification() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotification_ = null; + if (pushNotificationBuilder_ != null) { + pushNotificationBuilder_.dispose(); + pushNotificationBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder getPushNotificationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetPushNotificationFieldBuilder().getBuilder(); + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder() { + if (pushNotificationBuilder_ != null) { + return pushNotificationBuilder_.getMessageOrBuilder(); + } else { + return pushNotification_ == null ? + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotification_; + } + } + /** + *
+     * A configuration of a webhook that can be used to receive updates
+     * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> + internalGetPushNotificationFieldBuilder() { + if (pushNotificationBuilder_ == null) { + pushNotificationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder>( + getPushNotification(), + getParentForChildren(), + isClean()); + pushNotification_ = null; + } + return pushNotificationBuilder_; + } + + private int historyLength_ ; + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + @java.lang.Override + public int getHistoryLength() { + return historyLength_; + } + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @param value The historyLength to set. + * @return This builder for chaining. + */ + public Builder setHistoryLength(int value) { + + historyLength_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The maximum number of messages to include in the history. if 0, the
+     * history will be unlimited.
+     * 
+ * + * int32 history_length = 3; + * @return This builder for chaining. + */ + public Builder clearHistoryLength() { + bitField0_ = (bitField0_ & ~0x00000004); + historyLength_ = 0; + onChanged(); + return this; + } + + private boolean blocking_ ; + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + @java.lang.Override + public boolean getBlocking() { + return blocking_; + } + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @param value The blocking to set. + * @return This builder for chaining. + */ + public Builder setBlocking(boolean value) { + + blocking_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * If true, the message will be blocking until the task is completed. If
+     * false, the message will be non-blocking and the task will be returned
+     * immediately. It is the caller's responsibility to check for any task
+     * updates.
+     * 
+ * + * bool blocking = 4; + * @return This builder for chaining. + */ + public Builder clearBlocking() { + bitField0_ = (bitField0_ & ~0x00000008); + blocking_ = false; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageConfiguration) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageConfiguration) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageConfiguration parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java new file mode 100644 index 000000000..cdc78e9bf --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageConfigurationOrBuilder.java @@ -0,0 +1,104 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageConfigurationOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageConfiguration) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return A list containing the acceptedOutputModes. + */ + java.util.List + getAcceptedOutputModesList(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @return The count of acceptedOutputModes. + */ + int getAcceptedOutputModesCount(); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the element to return. + * @return The acceptedOutputModes at the given index. + */ + java.lang.String getAcceptedOutputModes(int index); + /** + *
+   * The output modes that the agent is expected to respond with.
+   * 
+ * + * repeated string accepted_output_modes = 1; + * @param index The index of the value to return. + * @return The bytes of the acceptedOutputModes at the given index. + */ + com.google.protobuf.ByteString + getAcceptedOutputModesBytes(int index); + + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return Whether the pushNotification field is set. + */ + boolean hasPushNotification(); + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + * @return The pushNotification. + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotification(); + /** + *
+   * A configuration of a webhook that can be used to receive updates
+   * 
+ * + * .a2a.v1.PushNotificationConfig push_notification = 2; + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationOrBuilder(); + + /** + *
+   * The maximum number of messages to include in the history. if 0, the
+   * history will be unlimited.
+   * 
+ * + * int32 history_length = 3; + * @return The historyLength. + */ + int getHistoryLength(); + + /** + *
+   * If true, the message will be blocking until the task is completed. If
+   * false, the message will be non-blocking and the task will be returned
+   * immediately. It is the caller's responsibility to check for any task
+   * updates.
+   * 
+ * + * bool blocking = 4; + * @return The blocking. + */ + boolean getBlocking(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java new file mode 100644 index 000000000..65fdd8940 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequest.java @@ -0,0 +1,937 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * /////////// Request Messages ///////////
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageRequest} + */ +@com.google.protobuf.Generated +public final class SendMessageRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageRequest) + SendMessageRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageRequest"); + } + // Use SendMessageRequest.newBuilder() to construct. + private SendMessageRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageRequest() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder.class); + } + + private int bitField0_; + public static final int REQUEST_FIELD_NUMBER = 1; + private org.a2aproject.sdk.compat03.grpc.Message request_; + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + @java.lang.Override + public boolean hasRequest() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getRequest() { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder() { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + + public static final int CONFIGURATION_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration configuration_; + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + @java.lang.Override + public boolean hasConfiguration() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration() { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder() { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + + public static final int METADATA_FIELD_NUMBER = 3; + private com.google.protobuf.Struct metadata_; + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getRequest()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getConfiguration()); + } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(3, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, getRequest()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getConfiguration()); + } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageRequest other = (org.a2aproject.sdk.compat03.grpc.SendMessageRequest) obj; + + if (hasRequest() != other.hasRequest()) return false; + if (hasRequest()) { + if (!getRequest() + .equals(other.getRequest())) return false; + } + if (hasConfiguration() != other.hasConfiguration()) return false; + if (hasConfiguration()) { + if (!getConfiguration() + .equals(other.getConfiguration())) return false; + } + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasRequest()) { + hash = (37 * hash) + REQUEST_FIELD_NUMBER; + hash = (53 * hash) + getRequest().hashCode(); + } + if (hasConfiguration()) { + hash = (37 * hash) + CONFIGURATION_FIELD_NUMBER; + hash = (53 * hash) + getConfiguration().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * /////////// Request Messages ///////////
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageRequest) + org.a2aproject.sdk.compat03.grpc.SendMessageRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.class, org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetRequestFieldBuilder(); + internalGetConfigurationFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + request_ = null; + if (requestBuilder_ != null) { + requestBuilder_.dispose(); + requestBuilder_ = null; + } + configuration_ = null; + if (configurationBuilder_ != null) { + configurationBuilder_.dispose(); + configurationBuilder_ = null; + } + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest build() { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest result = new org.a2aproject.sdk.compat03.grpc.SendMessageRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.request_ = requestBuilder_ == null + ? request_ + : requestBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.configuration_ = configurationBuilder_ == null + ? configuration_ + : configurationBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000004; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageRequest.getDefaultInstance()) return this; + if (other.hasRequest()) { + mergeRequest(other.getRequest()); + } + if (other.hasConfiguration()) { + mergeConfiguration(other.getConfiguration()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetRequestFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetConfigurationFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private org.a2aproject.sdk.compat03.grpc.Message request_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> requestBuilder_; + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + public boolean hasRequest() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + public org.a2aproject.sdk.compat03.grpc.Message getRequest() { + if (requestBuilder_ == null) { + return request_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } else { + return requestBuilder_.getMessage(); + } + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRequest(org.a2aproject.sdk.compat03.grpc.Message value) { + if (requestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + request_ = value; + } else { + requestBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder setRequest( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (requestBuilder_ == null) { + request_ = builderForValue.build(); + } else { + requestBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeRequest(org.a2aproject.sdk.compat03.grpc.Message value) { + if (requestBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) && + request_ != null && + request_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + getRequestBuilder().mergeFrom(value); + } else { + request_ = value; + } + } else { + requestBuilder_.mergeFrom(value); + } + if (request_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearRequest() { + bitField0_ = (bitField0_ & ~0x00000001); + request_ = null; + if (requestBuilder_ != null) { + requestBuilder_.dispose(); + requestBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getRequestBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return internalGetRequestFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder() { + if (requestBuilder_ != null) { + return requestBuilder_.getMessageOrBuilder(); + } else { + return request_ == null ? + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : request_; + } + } + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetRequestFieldBuilder() { + if (requestBuilder_ == null) { + requestBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + getRequest(), + getParentForChildren(), + isClean()); + request_ = null; + } + return requestBuilder_; + } + + private org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration configuration_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder> configurationBuilder_; + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + public boolean hasConfiguration() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration() { + if (configurationBuilder_ == null) { + return configuration_ == null ? org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } else { + return configurationBuilder_.getMessage(); + } + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder setConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration value) { + if (configurationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + configuration_ = value; + } else { + configurationBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder setConfiguration( + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder builderForValue) { + if (configurationBuilder_ == null) { + configuration_ = builderForValue.build(); + } else { + configurationBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder mergeConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration value) { + if (configurationBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + configuration_ != null && + configuration_ != org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance()) { + getConfigurationBuilder().mergeFrom(value); + } else { + configuration_ = value; + } + } else { + configurationBuilder_.mergeFrom(value); + } + if (configuration_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public Builder clearConfiguration() { + bitField0_ = (bitField0_ & ~0x00000002); + configuration_ = null; + if (configurationBuilder_ != null) { + configurationBuilder_.dispose(); + configurationBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder getConfigurationBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetConfigurationFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + public org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder() { + if (configurationBuilder_ != null) { + return configurationBuilder_.getMessageOrBuilder(); + } else { + return configuration_ == null ? + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.getDefaultInstance() : configuration_; + } + } + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder> + internalGetConfigurationFieldBuilder() { + if (configurationBuilder_ == null) { + configurationBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration, org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder, org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder>( + getConfiguration(), + getParentForChildren(), + isClean()); + configuration_ = null; + } + return configurationBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000004); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + * .google.protobuf.Struct metadata = 3; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + * .google.protobuf.Struct metadata = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageRequest) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java new file mode 100644 index 000000000..6adc2a4b0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageRequestOrBuilder.java @@ -0,0 +1,57 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return Whether the request field is set. + */ + boolean hasRequest(); + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + * @return The request. + */ + org.a2aproject.sdk.compat03.grpc.Message getRequest(); + /** + * .a2a.v1.Message request = 1 [json_name = "message", (.google.api.field_behavior) = REQUIRED]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getRequestOrBuilder(); + + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return Whether the configuration field is set. + */ + boolean hasConfiguration(); + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + * @return The configuration. + */ + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration getConfiguration(); + /** + * .a2a.v1.SendMessageConfiguration configuration = 2; + */ + org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder getConfigurationOrBuilder(); + + /** + * .google.protobuf.Struct metadata = 3; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + * .google.protobuf.Struct metadata = 3; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + * .google.protobuf.Struct metadata = 3; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java new file mode 100644 index 000000000..f2aad1a3c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponse.java @@ -0,0 +1,865 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * ////// Response Messages ///////////
+ * 
+ * + * Protobuf type {@code a2a.v1.SendMessageResponse} + */ +@com.google.protobuf.Generated +public final class SendMessageResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.SendMessageResponse) + SendMessageResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "SendMessageResponse"); + } + // Use SendMessageResponse.newBuilder() to construct. + private SendMessageResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private SendMessageResponse() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder.class); + } + + private int payloadCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object payload_; + public enum PayloadCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TASK(1), + MSG(2), + PAYLOAD_NOT_SET(0); + private final int value; + private PayloadCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PayloadCase valueOf(int value) { + return forNumber(value); + } + + public static PayloadCase forNumber(int value) { + switch (value) { + case 1: return TASK; + case 2: return MSG; + case 0: return PAYLOAD_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public static final int TASK_FIELD_NUMBER = 1; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + public static final int MSG_FIELD_NUMBER = 2; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (payloadCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (payloadCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.SendMessageResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.SendMessageResponse other = (org.a2aproject.sdk.compat03.grpc.SendMessageResponse) obj; + + if (!getPayloadCase().equals(other.getPayloadCase())) return false; + switch (payloadCase_) { + case 1: + if (!getTask() + .equals(other.getTask())) return false; + break; + case 2: + if (!getMsg() + .equals(other.getMsg())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (payloadCase_) { + case 1: + hash = (37 * hash) + TASK_FIELD_NUMBER; + hash = (53 * hash) + getTask().hashCode(); + break; + case 2: + hash = (37 * hash) + MSG_FIELD_NUMBER; + hash = (53 * hash) + getMsg().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.SendMessageResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * ////// Response Messages ///////////
+   * 
+ * + * Protobuf type {@code a2a.v1.SendMessageResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.SendMessageResponse) + org.a2aproject.sdk.compat03.grpc.SendMessageResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.class, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (taskBuilder_ != null) { + taskBuilder_.clear(); + } + if (msgBuilder_ != null) { + msgBuilder_.clear(); + } + payloadCase_ = 0; + payload_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_SendMessageResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse build() { + org.a2aproject.sdk.compat03.grpc.SendMessageResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.SendMessageResponse result = new org.a2aproject.sdk.compat03.grpc.SendMessageResponse(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.SendMessageResponse result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.SendMessageResponse result) { + result.payloadCase_ = payloadCase_; + result.payload_ = this.payload_; + if (payloadCase_ == 1 && + taskBuilder_ != null) { + result.payload_ = taskBuilder_.build(); + } + if (payloadCase_ == 2 && + msgBuilder_ != null) { + result.payload_ = msgBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.SendMessageResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.SendMessageResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.SendMessageResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.SendMessageResponse.getDefaultInstance()) return this; + switch (other.getPayloadCase()) { + case TASK: { + mergeTask(other.getTask()); + break; + } + case MSG: { + mergeMsg(other.getMsg()); + break; + } + case PAYLOAD_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetTaskFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetMsgFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 2; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int payloadCase_ = 0; + private java.lang.Object payload_; + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public Builder clearPayload() { + payloadCase_ = 0; + payload_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> taskBuilder_; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } else { + if (payloadCase_ == 1) { + return taskBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + taskBuilder_.setMessage(value); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask( + org.a2aproject.sdk.compat03.grpc.Task.Builder builderForValue) { + if (taskBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + taskBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder mergeTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (payloadCase_ == 1 && + payload_ != org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.newBuilder((org.a2aproject.sdk.compat03.grpc.Task) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 1) { + taskBuilder_.mergeFrom(value); + } else { + taskBuilder_.setMessage(value); + } + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder clearTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + } + taskBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public org.a2aproject.sdk.compat03.grpc.Task.Builder getTaskBuilder() { + return internalGetTaskFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if ((payloadCase_ == 1) && (taskBuilder_ != null)) { + return taskBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> + internalGetTaskFieldBuilder() { + if (taskBuilder_ == null) { + if (!(payloadCase_ == 1)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + taskBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Task) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 1; + onChanged(); + return taskBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> msgBuilder_; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } else { + if (payloadCase_ == 2) { + return msgBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + msgBuilder_.setMessage(value); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (msgBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + msgBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder mergeMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (payloadCase_ == 2 && + payload_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.newBuilder((org.a2aproject.sdk.compat03.grpc.Message) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 2) { + msgBuilder_.mergeFrom(value); + } else { + msgBuilder_.setMessage(value); + } + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder clearMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + } + msgBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getMsgBuilder() { + return internalGetMsgFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if ((payloadCase_ == 2) && (msgBuilder_ != null)) { + return msgBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetMsgFieldBuilder() { + if (msgBuilder_ == null) { + if (!(payloadCase_ == 2)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + msgBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Message) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 2; + onChanged(); + return msgBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.SendMessageResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.SendMessageResponse) + private static final org.a2aproject.sdk.compat03.grpc.SendMessageResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.SendMessageResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendMessageResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.SendMessageResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java new file mode 100644 index 000000000..3b71db61f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/SendMessageResponseOrBuilder.java @@ -0,0 +1,44 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface SendMessageResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.SendMessageResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + boolean hasTask(); + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + org.a2aproject.sdk.compat03.grpc.Task getTask(); + /** + * .a2a.v1.Task task = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder(); + + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + boolean hasMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + org.a2aproject.sdk.compat03.grpc.Message getMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.SendMessageResponse.PayloadCase getPayloadCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java new file mode 100644 index 000000000..55110d775 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponse.java @@ -0,0 +1,1297 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * The stream response for a message. The stream should be one of the following
+ * sequences:
+ * If the response is a message, the stream should contain one, and only one,
+ * message and then close
+ * If the response is a task lifecycle, the first response should be a Task
+ * object followed by zero or more TaskStatusUpdateEvents and
+ * TaskArtifactUpdateEvents. The stream should complete when the Task
+ * if in an interrupted or terminal state. A stream that ends before these
+ * conditions are met are
+ * 
+ * + * Protobuf type {@code a2a.v1.StreamResponse} + */ +@com.google.protobuf.Generated +public final class StreamResponse extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.StreamResponse) + StreamResponseOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "StreamResponse"); + } + // Use StreamResponse.newBuilder() to construct. + private StreamResponse(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private StreamResponse() { + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StreamResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StreamResponse.class, org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder.class); + } + + private int payloadCase_ = 0; + @SuppressWarnings("serial") + private java.lang.Object payload_; + public enum PayloadCase + implements com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + TASK(1), + MSG(2), + STATUS_UPDATE(3), + ARTIFACT_UPDATE(4), + PAYLOAD_NOT_SET(0); + private final int value; + private PayloadCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PayloadCase valueOf(int value) { + return forNumber(value); + } + + public static PayloadCase forNumber(int value) { + switch (value) { + case 1: return TASK; + case 2: return MSG; + case 3: return STATUS_UPDATE; + case 4: return ARTIFACT_UPDATE; + case 0: return PAYLOAD_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public static final int TASK_FIELD_NUMBER = 1; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + public static final int MSG_FIELD_NUMBER = 2; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + + public static final int STATUS_UPDATE_FIELD_NUMBER = 3; + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + @java.lang.Override + public boolean hasStatusUpdate() { + return payloadCase_ == 3; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate() { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder() { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + + public static final int ARTIFACT_UPDATE_FIELD_NUMBER = 4; + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + @java.lang.Override + public boolean hasArtifactUpdate() { + return payloadCase_ == 4; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate() { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder() { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (payloadCase_ == 1) { + output.writeMessage(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + output.writeMessage(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + if (payloadCase_ == 3) { + output.writeMessage(3, (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_); + } + if (payloadCase_ == 4) { + output.writeMessage(4, (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (payloadCase_ == 1) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, (org.a2aproject.sdk.compat03.grpc.Task) payload_); + } + if (payloadCase_ == 2) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, (org.a2aproject.sdk.compat03.grpc.Message) payload_); + } + if (payloadCase_ == 3) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_); + } + if (payloadCase_ == 4) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.StreamResponse)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.StreamResponse other = (org.a2aproject.sdk.compat03.grpc.StreamResponse) obj; + + if (!getPayloadCase().equals(other.getPayloadCase())) return false; + switch (payloadCase_) { + case 1: + if (!getTask() + .equals(other.getTask())) return false; + break; + case 2: + if (!getMsg() + .equals(other.getMsg())) return false; + break; + case 3: + if (!getStatusUpdate() + .equals(other.getStatusUpdate())) return false; + break; + case 4: + if (!getArtifactUpdate() + .equals(other.getArtifactUpdate())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (payloadCase_) { + case 1: + hash = (37 * hash) + TASK_FIELD_NUMBER; + hash = (53 * hash) + getTask().hashCode(); + break; + case 2: + hash = (37 * hash) + MSG_FIELD_NUMBER; + hash = (53 * hash) + getMsg().hashCode(); + break; + case 3: + hash = (37 * hash) + STATUS_UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getStatusUpdate().hashCode(); + break; + case 4: + hash = (37 * hash) + ARTIFACT_UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getArtifactUpdate().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StreamResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.StreamResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * The stream response for a message. The stream should be one of the following
+   * sequences:
+   * If the response is a message, the stream should contain one, and only one,
+   * message and then close
+   * If the response is a task lifecycle, the first response should be a Task
+   * object followed by zero or more TaskStatusUpdateEvents and
+   * TaskArtifactUpdateEvents. The stream should complete when the Task
+   * if in an interrupted or terminal state. A stream that ends before these
+   * conditions are met are
+   * 
+ * + * Protobuf type {@code a2a.v1.StreamResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.StreamResponse) + org.a2aproject.sdk.compat03.grpc.StreamResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StreamResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StreamResponse.class, org.a2aproject.sdk.compat03.grpc.StreamResponse.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (taskBuilder_ != null) { + taskBuilder_.clear(); + } + if (msgBuilder_ != null) { + msgBuilder_.clear(); + } + if (statusUpdateBuilder_ != null) { + statusUpdateBuilder_.clear(); + } + if (artifactUpdateBuilder_ != null) { + artifactUpdateBuilder_.clear(); + } + payloadCase_ = 0; + payload_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StreamResponse_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse build() { + org.a2aproject.sdk.compat03.grpc.StreamResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse buildPartial() { + org.a2aproject.sdk.compat03.grpc.StreamResponse result = new org.a2aproject.sdk.compat03.grpc.StreamResponse(this); + if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.StreamResponse result) { + int from_bitField0_ = bitField0_; + } + + private void buildPartialOneofs(org.a2aproject.sdk.compat03.grpc.StreamResponse result) { + result.payloadCase_ = payloadCase_; + result.payload_ = this.payload_; + if (payloadCase_ == 1 && + taskBuilder_ != null) { + result.payload_ = taskBuilder_.build(); + } + if (payloadCase_ == 2 && + msgBuilder_ != null) { + result.payload_ = msgBuilder_.build(); + } + if (payloadCase_ == 3 && + statusUpdateBuilder_ != null) { + result.payload_ = statusUpdateBuilder_.build(); + } + if (payloadCase_ == 4 && + artifactUpdateBuilder_ != null) { + result.payload_ = artifactUpdateBuilder_.build(); + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.StreamResponse) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.StreamResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.StreamResponse other) { + if (other == org.a2aproject.sdk.compat03.grpc.StreamResponse.getDefaultInstance()) return this; + switch (other.getPayloadCase()) { + case TASK: { + mergeTask(other.getTask()); + break; + } + case MSG: { + mergeMsg(other.getMsg()); + break; + } + case STATUS_UPDATE: { + mergeStatusUpdate(other.getStatusUpdate()); + break; + } + case ARTIFACT_UPDATE: { + mergeArtifactUpdate(other.getArtifactUpdate()); + break; + } + case PAYLOAD_NOT_SET: { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + internalGetTaskFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 1; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetMsgFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 2; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusUpdateFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 3; + break; + } // case 26 + case 34: { + input.readMessage( + internalGetArtifactUpdateFieldBuilder().getBuilder(), + extensionRegistry); + payloadCase_ = 4; + break; + } // case 34 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int payloadCase_ = 0; + private java.lang.Object payload_; + public PayloadCase + getPayloadCase() { + return PayloadCase.forNumber( + payloadCase_); + } + + public Builder clearPayload() { + payloadCase_ = 0; + payload_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> taskBuilder_; + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + @java.lang.Override + public boolean hasTask() { + return payloadCase_ == 1; + } + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } else { + if (payloadCase_ == 1) { + return taskBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + taskBuilder_.setMessage(value); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder setTask( + org.a2aproject.sdk.compat03.grpc.Task.Builder builderForValue) { + if (taskBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + taskBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder mergeTask(org.a2aproject.sdk.compat03.grpc.Task value) { + if (taskBuilder_ == null) { + if (payloadCase_ == 1 && + payload_ != org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.newBuilder((org.a2aproject.sdk.compat03.grpc.Task) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 1) { + taskBuilder_.mergeFrom(value); + } else { + taskBuilder_.setMessage(value); + } + } + payloadCase_ = 1; + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public Builder clearTask() { + if (taskBuilder_ == null) { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 1) { + payloadCase_ = 0; + payload_ = null; + } + taskBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Task task = 1; + */ + public org.a2aproject.sdk.compat03.grpc.Task.Builder getTaskBuilder() { + return internalGetTaskFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Task task = 1; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder() { + if ((payloadCase_ == 1) && (taskBuilder_ != null)) { + return taskBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 1) { + return (org.a2aproject.sdk.compat03.grpc.Task) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + } + /** + * .a2a.v1.Task task = 1; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder> + internalGetTaskFieldBuilder() { + if (taskBuilder_ == null) { + if (!(payloadCase_ == 1)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + taskBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Task, org.a2aproject.sdk.compat03.grpc.Task.Builder, org.a2aproject.sdk.compat03.grpc.TaskOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Task) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 1; + onChanged(); + return taskBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> msgBuilder_; + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + @java.lang.Override + public boolean hasMsg() { + return payloadCase_ == 2; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } else { + if (payloadCase_ == 2) { + return msgBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + msgBuilder_.setMessage(value); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder setMsg( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (msgBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + msgBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder mergeMsg(org.a2aproject.sdk.compat03.grpc.Message value) { + if (msgBuilder_ == null) { + if (payloadCase_ == 2 && + payload_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.newBuilder((org.a2aproject.sdk.compat03.grpc.Message) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 2) { + msgBuilder_.mergeFrom(value); + } else { + msgBuilder_.setMessage(value); + } + } + payloadCase_ = 2; + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public Builder clearMsg() { + if (msgBuilder_ == null) { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 2) { + payloadCase_ = 0; + payload_ = null; + } + msgBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getMsgBuilder() { + return internalGetMsgFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder() { + if ((payloadCase_ == 2) && (msgBuilder_ != null)) { + return msgBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 2) { + return (org.a2aproject.sdk.compat03.grpc.Message) payload_; + } + return org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + } + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetMsgFieldBuilder() { + if (msgBuilder_ == null) { + if (!(payloadCase_ == 2)) { + payload_ = org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance(); + } + msgBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.Message) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 2; + onChanged(); + return msgBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder> statusUpdateBuilder_; + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + @java.lang.Override + public boolean hasStatusUpdate() { + return payloadCase_ == 3; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate() { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } else { + if (payloadCase_ == 3) { + return statusUpdateBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder setStatusUpdate(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent value) { + if (statusUpdateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + statusUpdateBuilder_.setMessage(value); + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder setStatusUpdate( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder builderForValue) { + if (statusUpdateBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + statusUpdateBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder mergeStatusUpdate(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent value) { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3 && + payload_ != org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder((org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 3) { + statusUpdateBuilder_.mergeFrom(value); + } else { + statusUpdateBuilder_.setMessage(value); + } + } + payloadCase_ = 3; + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public Builder clearStatusUpdate() { + if (statusUpdateBuilder_ == null) { + if (payloadCase_ == 3) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 3) { + payloadCase_ = 0; + payload_ = null; + } + statusUpdateBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder getStatusUpdateBuilder() { + return internalGetStatusUpdateFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder() { + if ((payloadCase_ == 3) && (statusUpdateBuilder_ != null)) { + return statusUpdateBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 3) { + return (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder> + internalGetStatusUpdateFieldBuilder() { + if (statusUpdateBuilder_ == null) { + if (!(payloadCase_ == 3)) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + statusUpdateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 3; + onChanged(); + return statusUpdateBuilder_; + } + + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder> artifactUpdateBuilder_; + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + @java.lang.Override + public boolean hasArtifactUpdate() { + return payloadCase_ == 4; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate() { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } else { + if (payloadCase_ == 4) { + return artifactUpdateBuilder_.getMessage(); + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder setArtifactUpdate(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent value) { + if (artifactUpdateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + payload_ = value; + onChanged(); + } else { + artifactUpdateBuilder_.setMessage(value); + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder setArtifactUpdate( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder builderForValue) { + if (artifactUpdateBuilder_ == null) { + payload_ = builderForValue.build(); + onChanged(); + } else { + artifactUpdateBuilder_.setMessage(builderForValue.build()); + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder mergeArtifactUpdate(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent value) { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4 && + payload_ != org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance()) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder((org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_) + .mergeFrom(value).buildPartial(); + } else { + payload_ = value; + } + onChanged(); + } else { + if (payloadCase_ == 4) { + artifactUpdateBuilder_.mergeFrom(value); + } else { + artifactUpdateBuilder_.setMessage(value); + } + } + payloadCase_ = 4; + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public Builder clearArtifactUpdate() { + if (artifactUpdateBuilder_ == null) { + if (payloadCase_ == 4) { + payloadCase_ = 0; + payload_ = null; + onChanged(); + } + } else { + if (payloadCase_ == 4) { + payloadCase_ = 0; + payload_ = null; + } + artifactUpdateBuilder_.clear(); + } + return this; + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder getArtifactUpdateBuilder() { + return internalGetArtifactUpdateFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder() { + if ((payloadCase_ == 4) && (artifactUpdateBuilder_ != null)) { + return artifactUpdateBuilder_.getMessageOrBuilder(); + } else { + if (payloadCase_ == 4) { + return (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_; + } + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + } + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder> + internalGetArtifactUpdateFieldBuilder() { + if (artifactUpdateBuilder_ == null) { + if (!(payloadCase_ == 4)) { + payload_ = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + artifactUpdateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder>( + (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) payload_, + getParentForChildren(), + isClean()); + payload_ = null; + } + payloadCase_ = 4; + onChanged(); + return artifactUpdateBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.StreamResponse) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.StreamResponse) + private static final org.a2aproject.sdk.compat03.grpc.StreamResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.StreamResponse(); + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StreamResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java new file mode 100644 index 000000000..a6b71e2f2 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StreamResponseOrBuilder.java @@ -0,0 +1,74 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface StreamResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.StreamResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * .a2a.v1.Task task = 1; + * @return Whether the task field is set. + */ + boolean hasTask(); + /** + * .a2a.v1.Task task = 1; + * @return The task. + */ + org.a2aproject.sdk.compat03.grpc.Task getTask(); + /** + * .a2a.v1.Task task = 1; + */ + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder getTaskOrBuilder(); + + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return Whether the msg field is set. + */ + boolean hasMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + * @return The msg. + */ + org.a2aproject.sdk.compat03.grpc.Message getMsg(); + /** + * .a2a.v1.Message msg = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getMsgOrBuilder(); + + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return Whether the statusUpdate field is set. + */ + boolean hasStatusUpdate(); + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + * @return The statusUpdate. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getStatusUpdate(); + /** + * .a2a.v1.TaskStatusUpdateEvent status_update = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder getStatusUpdateOrBuilder(); + + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return Whether the artifactUpdate field is set. + */ + boolean hasArtifactUpdate(); + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + * @return The artifactUpdate. + */ + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getArtifactUpdate(); + /** + * .a2a.v1.TaskArtifactUpdateEvent artifact_update = 4; + */ + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder getArtifactUpdateOrBuilder(); + + org.a2aproject.sdk.compat03.grpc.StreamResponse.PayloadCase getPayloadCase(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java new file mode 100644 index 000000000..326244468 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringList.java @@ -0,0 +1,563 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+ * 
+ * + * Protobuf type {@code a2a.v1.StringList} + */ +@com.google.protobuf.Generated +public final class StringList extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.StringList) + StringListOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "StringList"); + } + // Use StringList.newBuilder() to construct. + private StringList(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private StringList() { + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StringList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StringList.class, org.a2aproject.sdk.compat03.grpc.StringList.Builder.class); + } + + public static final int LIST_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * repeated string list = 1; + * @return A list containing the list. + */ + public com.google.protobuf.ProtocolStringList + getListList() { + return list_; + } + /** + * repeated string list = 1; + * @return The count of list. + */ + public int getListCount() { + return list_.size(); + } + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + public java.lang.String getList(int index) { + return list_.get(index); + } + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + public com.google.protobuf.ByteString + getListBytes(int index) { + return list_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < list_.size(); i++) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, list_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < list_.size(); i++) { + dataSize += computeStringSizeNoTag(list_.getRaw(i)); + } + size += dataSize; + size += 1 * getListList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.StringList)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.StringList other = (org.a2aproject.sdk.compat03.grpc.StringList) obj; + + if (!getListList() + .equals(other.getListList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getListCount() > 0) { + hash = (37 * hash) + LIST_FIELD_NUMBER; + hash = (53 * hash) + getListList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.StringList parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.StringList prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * 
+ * + * Protobuf type {@code a2a.v1.StringList} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.StringList) + org.a2aproject.sdk.compat03.grpc.StringListOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StringList_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.StringList.class, org.a2aproject.sdk.compat03.grpc.StringList.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.StringList.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_StringList_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList build() { + org.a2aproject.sdk.compat03.grpc.StringList result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList buildPartial() { + org.a2aproject.sdk.compat03.grpc.StringList result = new org.a2aproject.sdk.compat03.grpc.StringList(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.StringList result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + list_.makeImmutable(); + result.list_ = list_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.StringList) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.StringList)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.StringList other) { + if (other == org.a2aproject.sdk.compat03.grpc.StringList.getDefaultInstance()) return this; + if (!other.list_.isEmpty()) { + if (list_.isEmpty()) { + list_ = other.list_; + bitField0_ |= 0x00000001; + } else { + ensureListIsMutable(); + list_.addAll(other.list_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + ensureListIsMutable(); + list_.add(s); + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private com.google.protobuf.LazyStringArrayList list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + private void ensureListIsMutable() { + if (!list_.isModifiable()) { + list_ = new com.google.protobuf.LazyStringArrayList(list_); + } + bitField0_ |= 0x00000001; + } + /** + * repeated string list = 1; + * @return A list containing the list. + */ + public com.google.protobuf.ProtocolStringList + getListList() { + list_.makeImmutable(); + return list_; + } + /** + * repeated string list = 1; + * @return The count of list. + */ + public int getListCount() { + return list_.size(); + } + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + public java.lang.String getList(int index) { + return list_.get(index); + } + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + public com.google.protobuf.ByteString + getListBytes(int index) { + return list_.getByteString(index); + } + /** + * repeated string list = 1; + * @param index The index to set the value at. + * @param value The list to set. + * @return This builder for chaining. + */ + public Builder setList( + int index, java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureListIsMutable(); + list_.set(index, value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param value The list to add. + * @return This builder for chaining. + */ + public Builder addList( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + ensureListIsMutable(); + list_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param values The list to add. + * @return This builder for chaining. + */ + public Builder addAllList( + java.lang.Iterable values) { + ensureListIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, list_); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @return This builder for chaining. + */ + public Builder clearList() { + list_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001);; + onChanged(); + return this; + } + /** + * repeated string list = 1; + * @param value The bytes of the list to add. + * @return This builder for chaining. + */ + public Builder addListBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + ensureListIsMutable(); + list_.add(value); + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.StringList) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.StringList) + private static final org.a2aproject.sdk.compat03.grpc.StringList DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.StringList(); + } + + public static org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StringList parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.StringList getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java new file mode 100644 index 000000000..461eb119f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/StringListOrBuilder.java @@ -0,0 +1,37 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface StringListOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.StringList) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated string list = 1; + * @return A list containing the list. + */ + java.util.List + getListList(); + /** + * repeated string list = 1; + * @return The count of list. + */ + int getListCount(); + /** + * repeated string list = 1; + * @param index The index of the element to return. + * @return The list at the given index. + */ + java.lang.String getList(int index); + /** + * repeated string list = 1; + * @param index The index of the value to return. + * @return The bytes of the list at the given index. + */ + com.google.protobuf.ByteString + getListBytes(int index); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java new file mode 100644 index 000000000..670dfd962 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/Task.java @@ -0,0 +1,2114 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * Task is the core unit of action for A2A. It has a current status
+ * and when results are created for the task they are stored in the
+ * artifact. If there are multiple turns for a task, these are stored in
+ * history.
+ * 
+ * + * Protobuf type {@code a2a.v1.Task} + */ +@com.google.protobuf.Generated +public final class Task extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.Task) + TaskOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "Task"); + } + // Use Task.newBuilder() to construct. + private Task(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private Task() { + id_ = ""; + contextId_ = ""; + artifacts_ = java.util.Collections.emptyList(); + history_ = java.util.Collections.emptyList(); + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Task.class, org.a2aproject.sdk.compat03.grpc.Task.Builder.class); + } + + private int bitField0_; + public static final int ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object id_ = ""; + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The id. + */ + @java.lang.Override + public java.lang.String getId() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } + } + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + + public static final int ARTIFACTS_FIELD_NUMBER = 4; + @SuppressWarnings("serial") + private java.util.List artifacts_; + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public java.util.List getArtifactsList() { + return artifacts_; + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public java.util.List + getArtifactsOrBuilderList() { + return artifacts_; + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public int getArtifactsCount() { + return artifacts_.size(); + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index) { + return artifacts_.get(index); + } + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index) { + return artifacts_.get(index); + } + + public static final int HISTORY_FIELD_NUMBER = 5; + @SuppressWarnings("serial") + private java.util.List history_; + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public java.util.List getHistoryList() { + return history_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public java.util.List + getHistoryOrBuilderList() { + return history_; + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public int getHistoryCount() { + return history_.size(); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getHistory(int index) { + return history_.get(index); + } + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index) { + return history_.get(index); + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getStatus()); + } + for (int i = 0; i < artifacts_.size(); i++) { + output.writeMessage(4, artifacts_.get(i)); + } + for (int i = 0; i < history_.size(); i++) { + output.writeMessage(5, history_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(6, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(id_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, id_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getStatus()); + } + for (int i = 0; i < artifacts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, artifacts_.get(i)); + } + for (int i = 0; i < history_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, history_.get(i)); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.Task)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.Task other = (org.a2aproject.sdk.compat03.grpc.Task) obj; + + if (!getId() + .equals(other.getId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } + if (!getArtifactsList() + .equals(other.getArtifactsList())) return false; + if (!getHistoryList() + .equals(other.getHistoryList())) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ID_FIELD_NUMBER; + hash = (53 * hash) + getId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + if (getArtifactsCount() > 0) { + hash = (37 * hash) + ARTIFACTS_FIELD_NUMBER; + hash = (53 * hash) + getArtifactsList().hashCode(); + } + if (getHistoryCount() > 0) { + hash = (37 * hash) + HISTORY_FIELD_NUMBER; + hash = (53 * hash) + getHistoryList().hashCode(); + } + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.Task parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.Task parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.Task prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * Task is the core unit of action for A2A. It has a current status
+   * and when results are created for the task they are stored in the
+   * artifact. If there are multiple turns for a task, these are stored in
+   * history.
+   * 
+ * + * Protobuf type {@code a2a.v1.Task} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.Task) + org.a2aproject.sdk.compat03.grpc.TaskOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Task_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.Task.class, org.a2aproject.sdk.compat03.grpc.Task.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.Task.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetStatusFieldBuilder(); + internalGetArtifactsFieldBuilder(); + internalGetHistoryFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + id_ = ""; + contextId_ = ""; + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + if (artifactsBuilder_ == null) { + artifacts_ = java.util.Collections.emptyList(); + } else { + artifacts_ = null; + artifactsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + if (historyBuilder_ == null) { + history_ = java.util.Collections.emptyList(); + } else { + history_ = null; + historyBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_Task_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task build() { + org.a2aproject.sdk.compat03.grpc.Task result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task buildPartial() { + org.a2aproject.sdk.compat03.grpc.Task result = new org.a2aproject.sdk.compat03.grpc.Task(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.a2aproject.sdk.compat03.grpc.Task result) { + if (artifactsBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0)) { + artifacts_ = java.util.Collections.unmodifiableList(artifacts_); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.artifacts_ = artifacts_; + } else { + result.artifacts_ = artifactsBuilder_.build(); + } + if (historyBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + history_ = java.util.Collections.unmodifiableList(history_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.history_ = history_; + } else { + result.history_ = historyBuilder_.build(); + } + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.Task result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.Task) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.Task)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.Task other) { + if (other == org.a2aproject.sdk.compat03.grpc.Task.getDefaultInstance()) return this; + if (!other.getId().isEmpty()) { + id_ = other.id_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (artifactsBuilder_ == null) { + if (!other.artifacts_.isEmpty()) { + if (artifacts_.isEmpty()) { + artifacts_ = other.artifacts_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureArtifactsIsMutable(); + artifacts_.addAll(other.artifacts_); + } + onChanged(); + } + } else { + if (!other.artifacts_.isEmpty()) { + if (artifactsBuilder_.isEmpty()) { + artifactsBuilder_.dispose(); + artifactsBuilder_ = null; + artifacts_ = other.artifacts_; + bitField0_ = (bitField0_ & ~0x00000008); + artifactsBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetArtifactsFieldBuilder() : null; + } else { + artifactsBuilder_.addAllMessages(other.artifacts_); + } + } + } + if (historyBuilder_ == null) { + if (!other.history_.isEmpty()) { + if (history_.isEmpty()) { + history_ = other.history_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureHistoryIsMutable(); + history_.addAll(other.history_); + } + onChanged(); + } + } else { + if (!other.history_.isEmpty()) { + if (historyBuilder_.isEmpty()) { + historyBuilder_.dispose(); + historyBuilder_ = null; + history_ = other.history_; + bitField0_ = (bitField0_ & ~0x00000010); + historyBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + internalGetHistoryFieldBuilder() : null; + } else { + historyBuilder_.addAllMessages(other.history_); + } + } + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + id_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: { + org.a2aproject.sdk.compat03.grpc.Artifact m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Artifact.parser(), + extensionRegistry); + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(m); + } else { + artifactsBuilder_.addMessage(m); + } + break; + } // case 34 + case 42: { + org.a2aproject.sdk.compat03.grpc.Message m = + input.readMessage( + org.a2aproject.sdk.compat03.grpc.Message.parser(), + extensionRegistry); + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(m); + } else { + historyBuilder_.addMessage(m); + } + break; + } // case 42 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object id_ = ""; + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return The id. + */ + public java.lang.String getId() { + java.lang.Object ref = id_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + id_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return The bytes for id. + */ + public com.google.protobuf.ByteString + getIdBytes() { + java.lang.Object ref = id_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + id_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @param value The id to set. + * @return This builder for chaining. + */ + public Builder setId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @return This builder for chaining. + */ + public Builder clearId() { + id_ = getDefaultInstance().getId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * Unique identifier for a task, created by the A2A server.
+     * 
+ * + * string id = 1; + * @param value The bytes for id to set. + * @return This builder for chaining. + */ + public Builder setIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + id_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * Unique identifier for the contextual collection of interactions (tasks
+     * and messages). Created by the A2A server.
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> statusBuilder_; + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus( + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder mergeStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + status_ != null && + status_ != org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder getStatusBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + } + /** + *
+     * The current status of a Task, including state and a message.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + + private java.util.List artifacts_ = + java.util.Collections.emptyList(); + private void ensureArtifactsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + artifacts_ = new java.util.ArrayList(artifacts_); + bitField0_ |= 0x00000008; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> artifactsBuilder_; + + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List getArtifactsList() { + if (artifactsBuilder_ == null) { + return java.util.Collections.unmodifiableList(artifacts_); + } else { + return artifactsBuilder_.getMessageList(); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public int getArtifactsCount() { + if (artifactsBuilder_ == null) { + return artifacts_.size(); + } else { + return artifactsBuilder_.getCount(); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index) { + if (artifactsBuilder_ == null) { + return artifacts_.get(index); + } else { + return artifactsBuilder_.getMessage(index); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder setArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.set(index, value); + onChanged(); + } else { + artifactsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder setArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.set(index, builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.add(value); + onChanged(); + } else { + artifactsBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureArtifactsIsMutable(); + artifacts_.add(index, value); + onChanged(); + } else { + artifactsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addArtifacts( + int index, org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.add(index, builderForValue.build()); + onChanged(); + } else { + artifactsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder addAllArtifacts( + java.lang.Iterable values) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, artifacts_); + onChanged(); + } else { + artifactsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder clearArtifacts() { + if (artifactsBuilder_ == null) { + artifacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + } else { + artifactsBuilder_.clear(); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public Builder removeArtifacts(int index) { + if (artifactsBuilder_ == null) { + ensureArtifactsIsMutable(); + artifacts_.remove(index); + onChanged(); + } else { + artifactsBuilder_.remove(index); + } + return this; + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder getArtifactsBuilder( + int index) { + return internalGetArtifactsFieldBuilder().getBuilder(index); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index) { + if (artifactsBuilder_ == null) { + return artifacts_.get(index); } else { + return artifactsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List + getArtifactsOrBuilderList() { + if (artifactsBuilder_ != null) { + return artifactsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(artifacts_); + } + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder addArtifactsBuilder() { + return internalGetArtifactsFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder addArtifactsBuilder( + int index) { + return internalGetArtifactsFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()); + } + /** + *
+     * A set of output artifacts for a Task.
+     * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + public java.util.List + getArtifactsBuilderList() { + return internalGetArtifactsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> + internalGetArtifactsFieldBuilder() { + if (artifactsBuilder_ == null) { + artifactsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder>( + artifacts_, + ((bitField0_ & 0x00000008) != 0), + getParentForChildren(), + isClean()); + artifacts_ = null; + } + return artifactsBuilder_; + } + + private java.util.List history_ = + java.util.Collections.emptyList(); + private void ensureHistoryIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + history_ = new java.util.ArrayList(history_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> historyBuilder_; + + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List getHistoryList() { + if (historyBuilder_ == null) { + return java.util.Collections.unmodifiableList(history_); + } else { + return historyBuilder_.getMessageList(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public int getHistoryCount() { + if (historyBuilder_ == null) { + return history_.size(); + } else { + return historyBuilder_.getCount(); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message getHistory(int index) { + if (historyBuilder_ == null) { + return history_.get(index); + } else { + return historyBuilder_.getMessage(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder setHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.set(index, value); + onChanged(); + } else { + historyBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder setHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.set(index, builderForValue.build()); + onChanged(); + } else { + historyBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory(org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.add(value); + onChanged(); + } else { + historyBuilder_.addMessage(value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message value) { + if (historyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureHistoryIsMutable(); + history_.add(index, value); + onChanged(); + } else { + historyBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(builderForValue.build()); + onChanged(); + } else { + historyBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addHistory( + int index, org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.add(index, builderForValue.build()); + onChanged(); + } else { + historyBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder addAllHistory( + java.lang.Iterable values) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, history_); + onChanged(); + } else { + historyBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder clearHistory() { + if (historyBuilder_ == null) { + history_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + historyBuilder_.clear(); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public Builder removeHistory(int index) { + if (historyBuilder_ == null) { + ensureHistoryIsMutable(); + history_.remove(index); + onChanged(); + } else { + historyBuilder_.remove(index); + } + return this; + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getHistoryBuilder( + int index) { + return internalGetHistoryFieldBuilder().getBuilder(index); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index) { + if (historyBuilder_ == null) { + return history_.get(index); } else { + return historyBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List + getHistoryOrBuilderList() { + if (historyBuilder_ != null) { + return historyBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(history_); + } + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder addHistoryBuilder() { + return internalGetHistoryFieldBuilder().addBuilder( + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder addHistoryBuilder( + int index) { + return internalGetHistoryFieldBuilder().addBuilder( + index, org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()); + } + /** + *
+     * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+     * The history of interactions from a task.
+     * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + public java.util.List + getHistoryBuilderList() { + return internalGetHistoryFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetHistoryFieldBuilder() { + if (historyBuilder_ == null) { + historyBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + history_, + ((bitField0_ & 0x00000010) != 0), + getParentForChildren(), + isClean()); + history_ = null; + } + return historyBuilder_; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+     * A key/value object to store custom metadata about a task.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.Task) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.Task) + private static final org.a2aproject.sdk.compat03.grpc.Task DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.Task(); + } + + public static org.a2aproject.sdk.compat03.grpc.Task getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Task parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Task getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java new file mode 100644 index 000000000..ab4d65257 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEvent.java @@ -0,0 +1,1344 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * TaskArtifactUpdateEvent represents a task delta where an artifact has
+ * been generated.
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskArtifactUpdateEvent} + */ +@com.google.protobuf.Generated +public final class TaskArtifactUpdateEvent extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskArtifactUpdateEvent) + TaskArtifactUpdateEventOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskArtifactUpdateEvent"); + } + // Use TaskArtifactUpdateEvent.newBuilder() to construct. + private TaskArtifactUpdateEvent(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskArtifactUpdateEvent() { + taskId_ = ""; + contextId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder.class); + } + + private int bitField0_; + public static final int TASK_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ARTIFACT_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.Artifact artifact_; + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + @java.lang.Override + public boolean hasArtifact() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifact() { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder() { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + + public static final int APPEND_FIELD_NUMBER = 4; + private boolean append_ = false; + /** + *
+   * Whether this should be appended to a prior one produced
+   * 
+ * + * bool append = 4; + * @return The append. + */ + @java.lang.Override + public boolean getAppend() { + return append_; + } + + public static final int LAST_CHUNK_FIELD_NUMBER = 5; + private boolean lastChunk_ = false; + /** + *
+   * Whether this represents the last part of an artifact
+   * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + @java.lang.Override + public boolean getLastChunk() { + return lastChunk_; + } + + public static final int METADATA_FIELD_NUMBER = 6; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getArtifact()); + } + if (append_ != false) { + output.writeBool(4, append_); + } + if (lastChunk_ != false) { + output.writeBool(5, lastChunk_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(6, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getArtifact()); + } + if (append_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, append_); + } + if (lastChunk_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, lastChunk_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent other = (org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) obj; + + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasArtifact() != other.hasArtifact()) return false; + if (hasArtifact()) { + if (!getArtifact() + .equals(other.getArtifact())) return false; + } + if (getAppend() + != other.getAppend()) return false; + if (getLastChunk() + != other.getLastChunk()) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasArtifact()) { + hash = (37 * hash) + ARTIFACT_FIELD_NUMBER; + hash = (53 * hash) + getArtifact().hashCode(); + } + hash = (37 * hash) + APPEND_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getAppend()); + hash = (37 * hash) + LAST_CHUNK_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getLastChunk()); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * TaskArtifactUpdateEvent represents a task delta where an artifact has
+   * been generated.
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskArtifactUpdateEvent} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskArtifactUpdateEvent) + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetArtifactFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + taskId_ = ""; + contextId_ = ""; + artifact_ = null; + if (artifactBuilder_ != null) { + artifactBuilder_.dispose(); + artifactBuilder_ = null; + } + append_ = false; + lastChunk_ = false; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskArtifactUpdateEvent_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent build() { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = new org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.artifact_ = artifactBuilder_ == null + ? artifact_ + : artifactBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.append_ = append_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.lastChunk_ = lastChunk_; + } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.getDefaultInstance()) return this; + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasArtifact()) { + mergeArtifact(other.getArtifact()); + } + if (other.getAppend() != false) { + setAppend(other.getAppend()); + } + if (other.getLastChunk() != false) { + setLastChunk(other.getLastChunk()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetArtifactFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + append_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 40: { + lastChunk_ = input.readBool(); + bitField0_ |= 0x00000010; + break; + } // case 40 + case 50: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 50 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object taskId_ = ""; + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The id of the task for this artifact
+     * 
+ * + * string task_id = 1; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The id of the context that this task belongs too
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.Artifact artifact_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> artifactBuilder_; + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + public boolean hasArtifact() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + public org.a2aproject.sdk.compat03.grpc.Artifact getArtifact() { + if (artifactBuilder_ == null) { + return artifact_ == null ? org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } else { + return artifactBuilder_.getMessage(); + } + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder setArtifact(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + artifact_ = value; + } else { + artifactBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder setArtifact( + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builderForValue) { + if (artifactBuilder_ == null) { + artifact_ = builderForValue.build(); + } else { + artifactBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder mergeArtifact(org.a2aproject.sdk.compat03.grpc.Artifact value) { + if (artifactBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + artifact_ != null && + artifact_ != org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance()) { + getArtifactBuilder().mergeFrom(value); + } else { + artifact_ = value; + } + } else { + artifactBuilder_.mergeFrom(value); + } + if (artifact_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public Builder clearArtifact() { + bitField0_ = (bitField0_ & ~0x00000004); + artifact_ = null; + if (artifactBuilder_ != null) { + artifactBuilder_.dispose(); + artifactBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public org.a2aproject.sdk.compat03.grpc.Artifact.Builder getArtifactBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetArtifactFieldBuilder().getBuilder(); + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + public org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder() { + if (artifactBuilder_ != null) { + return artifactBuilder_.getMessageOrBuilder(); + } else { + return artifact_ == null ? + org.a2aproject.sdk.compat03.grpc.Artifact.getDefaultInstance() : artifact_; + } + } + /** + *
+     * The artifact itself
+     * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder> + internalGetArtifactFieldBuilder() { + if (artifactBuilder_ == null) { + artifactBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Artifact, org.a2aproject.sdk.compat03.grpc.Artifact.Builder, org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder>( + getArtifact(), + getParentForChildren(), + isClean()); + artifact_ = null; + } + return artifactBuilder_; + } + + private boolean append_ ; + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @return The append. + */ + @java.lang.Override + public boolean getAppend() { + return append_; + } + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @param value The append to set. + * @return This builder for chaining. + */ + public Builder setAppend(boolean value) { + + append_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Whether this should be appended to a prior one produced
+     * 
+ * + * bool append = 4; + * @return This builder for chaining. + */ + public Builder clearAppend() { + bitField0_ = (bitField0_ & ~0x00000008); + append_ = false; + onChanged(); + return this; + } + + private boolean lastChunk_ ; + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + @java.lang.Override + public boolean getLastChunk() { + return lastChunk_; + } + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @param value The lastChunk to set. + * @return This builder for chaining. + */ + public Builder setLastChunk(boolean value) { + + lastChunk_ = value; + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Whether this represents the last part of an artifact
+     * 
+ * + * bool last_chunk = 5; + * @return This builder for chaining. + */ + public Builder clearLastChunk() { + bitField0_ = (bitField0_ & ~0x00000010); + lastChunk_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000020); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata associated with the artifact update.
+     * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskArtifactUpdateEvent) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskArtifactUpdateEvent) + private static final org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskArtifactUpdateEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java new file mode 100644 index 000000000..9abdfe8dd --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskArtifactUpdateEventOrBuilder.java @@ -0,0 +1,126 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskArtifactUpdateEventOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskArtifactUpdateEvent) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The id of the task for this artifact
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The id of the context that this task belongs too
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return Whether the artifact field is set. + */ + boolean hasArtifact(); + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + * @return The artifact. + */ + org.a2aproject.sdk.compat03.grpc.Artifact getArtifact(); + /** + *
+   * The artifact itself
+   * 
+ * + * .a2a.v1.Artifact artifact = 3; + */ + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactOrBuilder(); + + /** + *
+   * Whether this should be appended to a prior one produced
+   * 
+ * + * bool append = 4; + * @return The append. + */ + boolean getAppend(); + + /** + *
+   * Whether this represents the last part of an artifact
+   * 
+ * + * bool last_chunk = 5; + * @return The lastChunk. + */ + boolean getLastChunk(); + + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata associated with the artifact update.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java new file mode 100644 index 000000000..ee239d12c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskOrBuilder.java @@ -0,0 +1,204 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.Task) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The id. + */ + java.lang.String getId(); + /** + *
+   * Unique identifier for a task, created by the A2A server.
+   * 
+ * + * string id = 1; + * @return The bytes for id. + */ + com.google.protobuf.ByteString + getIdBytes(); + + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * Unique identifier for the contextual collection of interactions (tasks
+   * and messages). Created by the A2A server.
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus(); + /** + *
+   * The current status of a Task, including state and a message.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder(); + + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + java.util.List + getArtifactsList(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + org.a2aproject.sdk.compat03.grpc.Artifact getArtifacts(int index); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + int getArtifactsCount(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + java.util.List + getArtifactsOrBuilderList(); + /** + *
+   * A set of output artifacts for a Task.
+   * 
+ * + * repeated .a2a.v1.Artifact artifacts = 4; + */ + org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder getArtifactsOrBuilder( + int index); + + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + java.util.List + getHistoryList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + org.a2aproject.sdk.compat03.grpc.Message getHistory(int index); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + int getHistoryCount(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + java.util.List + getHistoryOrBuilderList(); + /** + *
+   * protolint:disable REPEATED_FIELD_NAMES_PLURALIZED
+   * The history of interactions from a task.
+   * 
+ * + * repeated .a2a.v1.Message history = 5; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getHistoryOrBuilder( + int index); + + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * protolint:enable REPEATED_FIELD_NAMES_PLURALIZED
+   * A key/value object to store custom metadata about a task.
+   * 
+ * + * .google.protobuf.Struct metadata = 6; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java new file mode 100644 index 000000000..be2e6a809 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfig.java @@ -0,0 +1,723 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.TaskPushNotificationConfig} + */ +@com.google.protobuf.Generated +public final class TaskPushNotificationConfig extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskPushNotificationConfig) + TaskPushNotificationConfigOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskPushNotificationConfig"); + } + // Use TaskPushNotificationConfig.newBuilder() to construct. + private TaskPushNotificationConfig(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskPushNotificationConfig() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder.class); + } + + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig_; + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + @java.lang.Override + public boolean hasPushNotificationConfig() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig() { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder() { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getPushNotificationConfig()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getPushNotificationConfig()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig other = (org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig) obj; + + if (!getName() + .equals(other.getName())) return false; + if (hasPushNotificationConfig() != other.hasPushNotificationConfig()) return false; + if (hasPushNotificationConfig()) { + if (!getPushNotificationConfig() + .equals(other.getPushNotificationConfig())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasPushNotificationConfig()) { + hash = (37 * hash) + PUSH_NOTIFICATION_CONFIG_FIELD_NUMBER; + hash = (53 * hash) + getPushNotificationConfig().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.TaskPushNotificationConfig} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskPushNotificationConfig) + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskPushNotificationConfig_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.class, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetPushNotificationConfigFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + pushNotificationConfig_ = null; + if (pushNotificationConfigBuilder_ != null) { + pushNotificationConfigBuilder_.dispose(); + pushNotificationConfigBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskPushNotificationConfig_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig build() { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = new org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pushNotificationConfig_ = pushNotificationConfigBuilder_ == null + ? pushNotificationConfig_ + : pushNotificationConfigBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasPushNotificationConfig()) { + mergePushNotificationConfig(other.getPushNotificationConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + input.readMessage( + internalGetPushNotificationConfigFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}/pushNotificationConfigs/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> pushNotificationConfigBuilder_; + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + public boolean hasPushNotificationConfig() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig() { + if (pushNotificationConfigBuilder_ == null) { + return pushNotificationConfig_ == null ? org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } else { + return pushNotificationConfigBuilder_.getMessage(); + } + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder setPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationConfigBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pushNotificationConfig_ = value; + } else { + pushNotificationConfigBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder setPushNotificationConfig( + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builderForValue) { + if (pushNotificationConfigBuilder_ == null) { + pushNotificationConfig_ = builderForValue.build(); + } else { + pushNotificationConfigBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder mergePushNotificationConfig(org.a2aproject.sdk.compat03.grpc.PushNotificationConfig value) { + if (pushNotificationConfigBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + pushNotificationConfig_ != null && + pushNotificationConfig_ != org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance()) { + getPushNotificationConfigBuilder().mergeFrom(value); + } else { + pushNotificationConfig_ = value; + } + } else { + pushNotificationConfigBuilder_.mergeFrom(value); + } + if (pushNotificationConfig_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public Builder clearPushNotificationConfig() { + bitField0_ = (bitField0_ & ~0x00000002); + pushNotificationConfig_ = null; + if (pushNotificationConfigBuilder_ != null) { + pushNotificationConfigBuilder_.dispose(); + pushNotificationConfigBuilder_ = null; + } + onChanged(); + return this; + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder getPushNotificationConfigBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetPushNotificationConfigFieldBuilder().getBuilder(); + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + public org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder() { + if (pushNotificationConfigBuilder_ != null) { + return pushNotificationConfigBuilder_.getMessageOrBuilder(); + } else { + return pushNotificationConfig_ == null ? + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.getDefaultInstance() : pushNotificationConfig_; + } + } + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder> + internalGetPushNotificationConfigFieldBuilder() { + if (pushNotificationConfigBuilder_ == null) { + pushNotificationConfigBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig, org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder, org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder>( + getPushNotificationConfig(), + getParentForChildren(), + isClean()); + pushNotificationConfig_ = null; + } + return pushNotificationConfigBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskPushNotificationConfig) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskPushNotificationConfig) + private static final org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskPushNotificationConfig parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java new file mode 100644 index 000000000..3320be16c --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskPushNotificationConfigOrBuilder.java @@ -0,0 +1,47 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskPushNotificationConfigOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskPushNotificationConfig) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}/pushNotificationConfigs/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); + + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return Whether the pushNotificationConfig field is set. + */ + boolean hasPushNotificationConfig(); + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + * @return The pushNotificationConfig. + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig getPushNotificationConfig(); + /** + * .a2a.v1.PushNotificationConfig push_notification_config = 2; + */ + org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder getPushNotificationConfigOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java new file mode 100644 index 000000000..d3e178ee9 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskState.java @@ -0,0 +1,268 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * The set of states a Task can be in.
+ * 
+ * + * Protobuf enum {@code a2a.v1.TaskState} + */ +@com.google.protobuf.Generated +public enum TaskState + implements com.google.protobuf.ProtocolMessageEnum { + /** + * TASK_STATE_UNSPECIFIED = 0; + */ + TASK_STATE_UNSPECIFIED(0), + /** + *
+   * Represents the status that acknowledges a task is created
+   * 
+ * + * TASK_STATE_SUBMITTED = 1; + */ + TASK_STATE_SUBMITTED(1), + /** + *
+   * Represents the status that a task is actively being processed
+   * 
+ * + * TASK_STATE_WORKING = 2; + */ + TASK_STATE_WORKING(2), + /** + *
+   * Represents the status a task is finished. This is a terminal state
+   * 
+ * + * TASK_STATE_COMPLETED = 3; + */ + TASK_STATE_COMPLETED(3), + /** + *
+   * Represents the status a task is done but failed. This is a terminal state
+   * 
+ * + * TASK_STATE_FAILED = 4; + */ + TASK_STATE_FAILED(4), + /** + *
+   * Represents the status a task was cancelled before it finished.
+   * This is a terminal state.
+   * 
+ * + * TASK_STATE_CANCELLED = 5; + */ + TASK_STATE_CANCELLED(5), + /** + *
+   * Represents the status that the task requires information to complete.
+   * This is an interrupted state.
+   * 
+ * + * TASK_STATE_INPUT_REQUIRED = 6; + */ + TASK_STATE_INPUT_REQUIRED(6), + /** + *
+   * Represents the status that the agent has decided to not perform the task.
+   * This may be done during initial task creation or later once an agent
+   * has determined it can't or won't proceed. This is a terminal state.
+   * 
+ * + * TASK_STATE_REJECTED = 7; + */ + TASK_STATE_REJECTED(7), + /** + *
+   * Represents the state that some authentication is needed from the upstream
+   * client. Authentication is expected to come out-of-band thus this is not
+   * an interrupted or terminal state.
+   * 
+ * + * TASK_STATE_AUTH_REQUIRED = 8; + */ + TASK_STATE_AUTH_REQUIRED(8), + UNRECOGNIZED(-1), + ; + + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskState"); + } + /** + * TASK_STATE_UNSPECIFIED = 0; + */ + public static final int TASK_STATE_UNSPECIFIED_VALUE = 0; + /** + *
+   * Represents the status that acknowledges a task is created
+   * 
+ * + * TASK_STATE_SUBMITTED = 1; + */ + public static final int TASK_STATE_SUBMITTED_VALUE = 1; + /** + *
+   * Represents the status that a task is actively being processed
+   * 
+ * + * TASK_STATE_WORKING = 2; + */ + public static final int TASK_STATE_WORKING_VALUE = 2; + /** + *
+   * Represents the status a task is finished. This is a terminal state
+   * 
+ * + * TASK_STATE_COMPLETED = 3; + */ + public static final int TASK_STATE_COMPLETED_VALUE = 3; + /** + *
+   * Represents the status a task is done but failed. This is a terminal state
+   * 
+ * + * TASK_STATE_FAILED = 4; + */ + public static final int TASK_STATE_FAILED_VALUE = 4; + /** + *
+   * Represents the status a task was cancelled before it finished.
+   * This is a terminal state.
+   * 
+ * + * TASK_STATE_CANCELLED = 5; + */ + public static final int TASK_STATE_CANCELLED_VALUE = 5; + /** + *
+   * Represents the status that the task requires information to complete.
+   * This is an interrupted state.
+   * 
+ * + * TASK_STATE_INPUT_REQUIRED = 6; + */ + public static final int TASK_STATE_INPUT_REQUIRED_VALUE = 6; + /** + *
+   * Represents the status that the agent has decided to not perform the task.
+   * This may be done during initial task creation or later once an agent
+   * has determined it can't or won't proceed. This is a terminal state.
+   * 
+ * + * TASK_STATE_REJECTED = 7; + */ + public static final int TASK_STATE_REJECTED_VALUE = 7; + /** + *
+   * Represents the state that some authentication is needed from the upstream
+   * client. Authentication is expected to come out-of-band thus this is not
+   * an interrupted or terminal state.
+   * 
+ * + * TASK_STATE_AUTH_REQUIRED = 8; + */ + public static final int TASK_STATE_AUTH_REQUIRED_VALUE = 8; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static TaskState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static TaskState forNumber(int value) { + switch (value) { + case 0: return TASK_STATE_UNSPECIFIED; + case 1: return TASK_STATE_SUBMITTED; + case 2: return TASK_STATE_WORKING; + case 3: return TASK_STATE_COMPLETED; + case 4: return TASK_STATE_FAILED; + case 5: return TASK_STATE_CANCELLED; + case 6: return TASK_STATE_INPUT_REQUIRED; + case 7: return TASK_STATE_REJECTED; + case 8: return TASK_STATE_AUTH_REQUIRED; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + TaskState> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public TaskState findValueByNumber(int number) { + return TaskState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.getDescriptor().getEnumTypes().get(0); + } + + private static final TaskState[] VALUES = values(); + + public static TaskState valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private TaskState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:a2a.v1.TaskState) +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java new file mode 100644 index 000000000..233e87d66 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatus.java @@ -0,0 +1,980 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * A container for the status of a task
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskStatus} + */ +@com.google.protobuf.Generated +public final class TaskStatus extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskStatus) + TaskStatusOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskStatus"); + } + // Use TaskStatus.newBuilder() to construct. + private TaskStatus(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskStatus() { + state_ = 0; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatus.class, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder.class); + } + + private int bitField0_; + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override public int getStateValue() { + return state_; + } + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + @java.lang.Override public org.a2aproject.sdk.compat03.grpc.TaskState getState() { + org.a2aproject.sdk.compat03.grpc.TaskState result = org.a2aproject.sdk.compat03.grpc.TaskState.forNumber(state_); + return result == null ? org.a2aproject.sdk.compat03.grpc.TaskState.UNRECOGNIZED : result; + } + + public static final int UPDATE_FIELD_NUMBER = 2; + private org.a2aproject.sdk.compat03.grpc.Message update_; + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + @java.lang.Override + public boolean hasUpdate() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.Message getUpdate() { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder() { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + + public static final int TIMESTAMP_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp timestamp_; + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + @java.lang.Override + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getTimestamp() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (state_ != org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED.getNumber()) { + output.writeEnum(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getUpdate()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getTimestamp()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ != org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getUpdate()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getTimestamp()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskStatus)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskStatus other = (org.a2aproject.sdk.compat03.grpc.TaskStatus) obj; + + if (state_ != other.state_) return false; + if (hasUpdate() != other.hasUpdate()) return false; + if (hasUpdate()) { + if (!getUpdate() + .equals(other.getUpdate())) return false; + } + if (hasTimestamp() != other.hasTimestamp()) return false; + if (hasTimestamp()) { + if (!getTimestamp() + .equals(other.getTimestamp())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasUpdate()) { + hash = (37 * hash) + UPDATE_FIELD_NUMBER; + hash = (53 * hash) + getUpdate().hashCode(); + } + if (hasTimestamp()) { + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + getTimestamp().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * A container for the status of a task
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskStatus} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskStatus) + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatus.class, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetUpdateFieldBuilder(); + internalGetTimestampFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + update_ = null; + if (updateBuilder_ != null) { + updateBuilder_.dispose(); + updateBuilder_ = null; + } + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatus_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus build() { + org.a2aproject.sdk.compat03.grpc.TaskStatus result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskStatus result = new org.a2aproject.sdk.compat03.grpc.TaskStatus(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskStatus result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.update_ = updateBuilder_ == null + ? update_ + : updateBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.timestamp_ = timestampBuilder_ == null + ? timestamp_ + : timestampBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskStatus) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskStatus)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskStatus other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasUpdate()) { + mergeUpdate(other.getUpdate()); + } + if (other.hasTimestamp()) { + mergeTimestamp(other.getTimestamp()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + input.readMessage( + internalGetUpdateFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetTimestampFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private int state_ = 0; + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override public int getStateValue() { + return state_; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskState getState() { + org.a2aproject.sdk.compat03.grpc.TaskState result = org.a2aproject.sdk.compat03.grpc.TaskState.forNumber(state_); + return result == null ? org.a2aproject.sdk.compat03.grpc.TaskState.UNRECOGNIZED : result; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(org.a2aproject.sdk.compat03.grpc.TaskState value) { + if (value == null) { throw new NullPointerException(); } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + *
+     * The current state of this task
+     * 
+ * + * .a2a.v1.TaskState state = 1; + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.Message update_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> updateBuilder_; + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + public boolean hasUpdate() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + public org.a2aproject.sdk.compat03.grpc.Message getUpdate() { + if (updateBuilder_ == null) { + return update_ == null ? org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } else { + return updateBuilder_.getMessage(); + } + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder setUpdate(org.a2aproject.sdk.compat03.grpc.Message value) { + if (updateBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + update_ = value; + } else { + updateBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder setUpdate( + org.a2aproject.sdk.compat03.grpc.Message.Builder builderForValue) { + if (updateBuilder_ == null) { + update_ = builderForValue.build(); + } else { + updateBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder mergeUpdate(org.a2aproject.sdk.compat03.grpc.Message value) { + if (updateBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) && + update_ != null && + update_ != org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance()) { + getUpdateBuilder().mergeFrom(value); + } else { + update_ = value; + } + } else { + updateBuilder_.mergeFrom(value); + } + if (update_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public Builder clearUpdate() { + bitField0_ = (bitField0_ & ~0x00000002); + update_ = null; + if (updateBuilder_ != null) { + updateBuilder_.dispose(); + updateBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.Message.Builder getUpdateBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return internalGetUpdateFieldBuilder().getBuilder(); + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + public org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder() { + if (updateBuilder_ != null) { + return updateBuilder_.getMessageOrBuilder(); + } else { + return update_ == null ? + org.a2aproject.sdk.compat03.grpc.Message.getDefaultInstance() : update_; + } + } + /** + *
+     * A message associated with the status.
+     * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder> + internalGetUpdateFieldBuilder() { + if (updateBuilder_ == null) { + updateBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.Message, org.a2aproject.sdk.compat03.grpc.Message.Builder, org.a2aproject.sdk.compat03.grpc.MessageOrBuilder>( + getUpdate(), + getParentForChildren(), + isClean()); + update_ = null; + } + return updateBuilder_; + } + + private com.google.protobuf.Timestamp timestamp_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> timestampBuilder_; + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + public boolean hasTimestamp() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + public com.google.protobuf.Timestamp getTimestamp() { + if (timestampBuilder_ == null) { + return timestamp_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } else { + return timestampBuilder_.getMessage(); + } + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder setTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + timestamp_ = value; + } else { + timestampBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder setTimestamp( + com.google.protobuf.Timestamp.Builder builderForValue) { + if (timestampBuilder_ == null) { + timestamp_ = builderForValue.build(); + } else { + timestampBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder mergeTimestamp(com.google.protobuf.Timestamp value) { + if (timestampBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + timestamp_ != null && + timestamp_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getTimestampBuilder().mergeFrom(value); + } else { + timestamp_ = value; + } + } else { + timestampBuilder_.mergeFrom(value); + } + if (timestamp_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public Builder clearTimestamp() { + bitField0_ = (bitField0_ & ~0x00000004); + timestamp_ = null; + if (timestampBuilder_ != null) { + timestampBuilder_.dispose(); + timestampBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public com.google.protobuf.Timestamp.Builder getTimestampBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetTimestampFieldBuilder().getBuilder(); + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + public com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder() { + if (timestampBuilder_ != null) { + return timestampBuilder_.getMessageOrBuilder(); + } else { + return timestamp_ == null ? + com.google.protobuf.Timestamp.getDefaultInstance() : timestamp_; + } + } + /** + *
+     * Timestamp when the status was recorded.
+     * Example: "2023-10-27T10:00:00Z"
+     * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> + internalGetTimestampFieldBuilder() { + if (timestampBuilder_ == null) { + timestampBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>( + getTimestamp(), + getParentForChildren(), + isClean()); + timestamp_ = null; + } + return timestampBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskStatus) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskStatus) + private static final org.a2aproject.sdk.compat03.grpc.TaskStatus DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskStatus(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java new file mode 100644 index 000000000..025ed99bc --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusOrBuilder.java @@ -0,0 +1,88 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskStatusOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskStatus) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + *
+   * The current state of this task
+   * 
+ * + * .a2a.v1.TaskState state = 1; + * @return The state. + */ + org.a2aproject.sdk.compat03.grpc.TaskState getState(); + + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return Whether the update field is set. + */ + boolean hasUpdate(); + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + * @return The update. + */ + org.a2aproject.sdk.compat03.grpc.Message getUpdate(); + /** + *
+   * A message associated with the status.
+   * 
+ * + * .a2a.v1.Message update = 2 [json_name = "message"]; + */ + org.a2aproject.sdk.compat03.grpc.MessageOrBuilder getUpdateOrBuilder(); + + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return Whether the timestamp field is set. + */ + boolean hasTimestamp(); + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + * @return The timestamp. + */ + com.google.protobuf.Timestamp getTimestamp(); + /** + *
+   * Timestamp when the status was recorded.
+   * Example: "2023-10-27T10:00:00Z"
+   * 
+ * + * .google.protobuf.Timestamp timestamp = 3; + */ + com.google.protobuf.TimestampOrBuilder getTimestampOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java new file mode 100644 index 000000000..5b1985f9f --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEvent.java @@ -0,0 +1,1261 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + *
+ * TaskStatusUpdateEvent is a delta even on a task indicating that a task
+ * has changed.
+ * 
+ * + * Protobuf type {@code a2a.v1.TaskStatusUpdateEvent} + */ +@com.google.protobuf.Generated +public final class TaskStatusUpdateEvent extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskStatusUpdateEvent) + TaskStatusUpdateEventOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskStatusUpdateEvent"); + } + // Use TaskStatusUpdateEvent.newBuilder() to construct. + private TaskStatusUpdateEvent(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskStatusUpdateEvent() { + taskId_ = ""; + contextId_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder.class); + } + + private int bitField0_; + public static final int TASK_ID_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object taskId_ = ""; + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + @java.lang.Override + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } + } + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CONTEXT_ID_FIELD_NUMBER = 2; + @SuppressWarnings("serial") + private volatile java.lang.Object contextId_ = ""; + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + @java.lang.Override + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } + } + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_FIELD_NUMBER = 3; + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + + public static final int FINAL_FIELD_NUMBER = 4; + private boolean final_ = false; + /** + *
+   * Whether this is the last status update expected for this task.
+   * 
+ * + * bool final = 4; + * @return The final. + */ + @java.lang.Override + public boolean getFinal() { + return final_; + } + + public static final int METADATA_FIELD_NUMBER = 5; + private com.google.protobuf.Struct metadata_; + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + @java.lang.Override + public boolean hasMetadata() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + @java.lang.Override + public com.google.protobuf.Struct getMetadata() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + @java.lang.Override + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getStatus()); + } + if (final_ != false) { + output.writeBool(4, final_); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(5, getMetadata()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(taskId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, taskId_); + } + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(contextId_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, contextId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, getStatus()); + } + if (final_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(4, final_); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getMetadata()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent other = (org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) obj; + + if (!getTaskId() + .equals(other.getTaskId())) return false; + if (!getContextId() + .equals(other.getContextId())) return false; + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus() + .equals(other.getStatus())) return false; + } + if (getFinal() + != other.getFinal()) return false; + if (hasMetadata() != other.hasMetadata()) return false; + if (hasMetadata()) { + if (!getMetadata() + .equals(other.getMetadata())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TASK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTaskId().hashCode(); + hash = (37 * hash) + CONTEXT_ID_FIELD_NUMBER; + hash = (53 * hash) + getContextId().hashCode(); + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (37 * hash) + FINAL_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getFinal()); + if (hasMetadata()) { + hash = (37 * hash) + METADATA_FIELD_NUMBER; + hash = (53 * hash) + getMetadata().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+   * TaskStatusUpdateEvent is a delta even on a task indicating that a task
+   * has changed.
+   * 
+ * + * Protobuf type {@code a2a.v1.TaskStatusUpdateEvent} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskStatusUpdateEvent) + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.class, org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage + .alwaysUseFieldBuilders) { + internalGetStatusFieldBuilder(); + internalGetMetadataFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + taskId_ = ""; + contextId_ = ""; + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + final_ = false; + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskStatusUpdateEvent_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent build() { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = new org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.taskId_ = taskId_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.contextId_ = contextId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.status_ = statusBuilder_ == null + ? status_ + : statusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.final_ = final_; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.metadata_ = metadataBuilder_ == null + ? metadata_ + : metadataBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.getDefaultInstance()) return this; + if (!other.getTaskId().isEmpty()) { + taskId_ = other.taskId_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getContextId().isEmpty()) { + contextId_ = other.contextId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + if (other.getFinal() != false) { + setFinal(other.getFinal()); + } + if (other.hasMetadata()) { + mergeMetadata(other.getMetadata()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + taskId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + contextId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + input.readMessage( + internalGetStatusFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 32: { + final_ = input.readBool(); + bitField0_ |= 0x00000008; + break; + } // case 32 + case 42: { + input.readMessage( + internalGetMetadataFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000010; + break; + } // case 42 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object taskId_ = ""; + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return The taskId. + */ + public java.lang.String getTaskId() { + java.lang.Object ref = taskId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + taskId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + public com.google.protobuf.ByteString + getTaskIdBytes() { + java.lang.Object ref = taskId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + taskId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @param value The taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @return This builder for chaining. + */ + public Builder clearTaskId() { + taskId_ = getDefaultInstance().getTaskId(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * The id of the task that is changed
+     * 
+ * + * string task_id = 1; + * @param value The bytes for taskId to set. + * @return This builder for chaining. + */ + public Builder setTaskIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + taskId_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object contextId_ = ""; + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return The contextId. + */ + public java.lang.String getContextId() { + java.lang.Object ref = contextId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + contextId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + public com.google.protobuf.ByteString + getContextIdBytes() { + java.lang.Object ref = contextId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + contextId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @param value The contextId to set. + * @return This builder for chaining. + */ + public Builder setContextId( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @return This builder for chaining. + */ + public Builder clearContextId() { + contextId_ = getDefaultInstance().getContextId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + *
+     * The id of the context that the task belongs to
+     * 
+ * + * string context_id = 2; + * @param value The bytes for contextId to set. + * @return This builder for chaining. + */ + public Builder setContextIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + contextId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private org.a2aproject.sdk.compat03.grpc.TaskStatus status_; + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> statusBuilder_; + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus() { + if (statusBuilder_ == null) { + return status_ == null ? org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder setStatus( + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder mergeStatus(org.a2aproject.sdk.compat03.grpc.TaskStatus value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) && + status_ != null && + status_ != org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000004); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder getStatusBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return internalGetStatusFieldBuilder().getBuilder(); + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + public org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null ? + org.a2aproject.sdk.compat03.grpc.TaskStatus.getDefaultInstance() : status_; + } + } + /** + *
+     * The new status of the task.
+     * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder> + internalGetStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.a2aproject.sdk.compat03.grpc.TaskStatus, org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder, org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder>( + getStatus(), + getParentForChildren(), + isClean()); + status_ = null; + } + return statusBuilder_; + } + + private boolean final_ ; + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @return The final. + */ + @java.lang.Override + public boolean getFinal() { + return final_; + } + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @param value The final to set. + * @return This builder for chaining. + */ + public Builder setFinal(boolean value) { + + final_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + *
+     * Whether this is the last status update expected for this task.
+     * 
+ * + * bool final = 4; + * @return This builder for chaining. + */ + public Builder clearFinal() { + bitField0_ = (bitField0_ & ~0x00000008); + final_ = false; + onChanged(); + return this; + } + + private com.google.protobuf.Struct metadata_; + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> metadataBuilder_; + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + public boolean hasMetadata() { + return ((bitField0_ & 0x00000010) != 0); + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + public com.google.protobuf.Struct getMetadata() { + if (metadataBuilder_ == null) { + return metadata_ == null ? com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } else { + return metadataBuilder_.getMessage(); + } + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder setMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + metadata_ = value; + } else { + metadataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder setMetadata( + com.google.protobuf.Struct.Builder builderForValue) { + if (metadataBuilder_ == null) { + metadata_ = builderForValue.build(); + } else { + metadataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder mergeMetadata(com.google.protobuf.Struct value) { + if (metadataBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0) && + metadata_ != null && + metadata_ != com.google.protobuf.Struct.getDefaultInstance()) { + getMetadataBuilder().mergeFrom(value); + } else { + metadata_ = value; + } + } else { + metadataBuilder_.mergeFrom(value); + } + if (metadata_ != null) { + bitField0_ |= 0x00000010; + onChanged(); + } + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public Builder clearMetadata() { + bitField0_ = (bitField0_ & ~0x00000010); + metadata_ = null; + if (metadataBuilder_ != null) { + metadataBuilder_.dispose(); + metadataBuilder_ = null; + } + onChanged(); + return this; + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public com.google.protobuf.Struct.Builder getMetadataBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return internalGetMetadataFieldBuilder().getBuilder(); + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + public com.google.protobuf.StructOrBuilder getMetadataOrBuilder() { + if (metadataBuilder_ != null) { + return metadataBuilder_.getMessageOrBuilder(); + } else { + return metadata_ == null ? + com.google.protobuf.Struct.getDefaultInstance() : metadata_; + } + } + /** + *
+     * Optional metadata to associate with the task update.
+     * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + private com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder> + internalGetMetadataFieldBuilder() { + if (metadataBuilder_ == null) { + metadataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + com.google.protobuf.Struct, com.google.protobuf.Struct.Builder, com.google.protobuf.StructOrBuilder>( + getMetadata(), + getParentForChildren(), + isClean()); + metadata_ = null; + } + return metadataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskStatusUpdateEvent) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskStatusUpdateEvent) + private static final org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskStatusUpdateEvent parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java new file mode 100644 index 000000000..02a951004 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskStatusUpdateEventOrBuilder.java @@ -0,0 +1,116 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskStatusUpdateEventOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskStatusUpdateEvent) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The taskId. + */ + java.lang.String getTaskId(); + /** + *
+   * The id of the task that is changed
+   * 
+ * + * string task_id = 1; + * @return The bytes for taskId. + */ + com.google.protobuf.ByteString + getTaskIdBytes(); + + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The contextId. + */ + java.lang.String getContextId(); + /** + *
+   * The id of the context that the task belongs to
+   * 
+ * + * string context_id = 2; + * @return The bytes for contextId. + */ + com.google.protobuf.ByteString + getContextIdBytes(); + + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + * @return The status. + */ + org.a2aproject.sdk.compat03.grpc.TaskStatus getStatus(); + /** + *
+   * The new status of the task.
+   * 
+ * + * .a2a.v1.TaskStatus status = 3; + */ + org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder getStatusOrBuilder(); + + /** + *
+   * Whether this is the last status update expected for this task.
+   * 
+ * + * bool final = 4; + * @return The final. + */ + boolean getFinal(); + + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return Whether the metadata field is set. + */ + boolean hasMetadata(); + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + * @return The metadata. + */ + com.google.protobuf.Struct getMetadata(); + /** + *
+   * Optional metadata to associate with the task update.
+   * 
+ * + * .google.protobuf.Struct metadata = 5; + */ + com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java new file mode 100644 index 000000000..a9789c814 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequest.java @@ -0,0 +1,530 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +/** + * Protobuf type {@code a2a.v1.TaskSubscriptionRequest} + */ +@com.google.protobuf.Generated +public final class TaskSubscriptionRequest extends + com.google.protobuf.GeneratedMessage implements + // @@protoc_insertion_point(message_implements:a2a.v1.TaskSubscriptionRequest) + TaskSubscriptionRequestOrBuilder { +private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 33, + /* patch= */ 1, + /* suffix= */ "", + "TaskSubscriptionRequest"); + } + // Use TaskSubscriptionRequest.newBuilder() to construct. + private TaskSubscriptionRequest(com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + } + private TaskSubscriptionRequest() { + name_ = ""; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessage.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest)) { + return super.equals(obj); + } + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest other = (org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) obj; + + if (!getName() + .equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input); + } + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessage + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code a2a.v1.TaskSubscriptionRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder implements + // @@protoc_insertion_point(builder_implements:a2a.v1.TaskSubscriptionRequest) + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskSubscriptionRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.class, org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.Builder.class); + } + + // Construct using org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.newBuilder() + private Builder() { + + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + + } + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.a2aproject.sdk.compat03.grpc.A2A.internal_static_a2a_v1_TaskSubscriptionRequest_descriptor; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstanceForType() { + return org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance(); + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest build() { + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest buildPartial() { + org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result = new org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest) { + return mergeFrom((org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest other) { + if (other == org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return The bytes for name. + */ + public com.google.protobuf.ByteString + getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName( + java.lang.String value) { + if (value == null) { throw new NullPointerException(); } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + *
+     * name=tasks/{id}
+     * 
+ * + * string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes( + com.google.protobuf.ByteString value) { + if (value == null) { throw new NullPointerException(); } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:a2a.v1.TaskSubscriptionRequest) + } + + // @@protoc_insertion_point(class_scope:a2a.v1.TaskSubscriptionRequest) + private static final org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TaskSubscriptionRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + +} + diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java new file mode 100644 index 000000000..a5edfc6f0 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/TaskSubscriptionRequestOrBuilder.java @@ -0,0 +1,32 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// NO CHECKED-IN PROTOBUF GENCODE +// source: a2a.proto +// Protobuf Java Version: 4.33.1 + +package org.a2aproject.sdk.compat03.grpc; + +@com.google.protobuf.Generated +public interface TaskSubscriptionRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:a2a.v1.TaskSubscriptionRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The name. + */ + java.lang.String getName(); + /** + *
+   * name=tasks/{id}
+   * 
+ * + * string name = 1; + * @return The bytes for name. + */ + com.google.protobuf.ByteString + getNameBytes(); +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils.java new file mode 100644 index 000000000..a7c673c3b --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/ProtoUtils.java @@ -0,0 +1,1025 @@ +package org.a2aproject.sdk.compat03.grpc.utils; + + +import java.nio.charset.StandardCharsets; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.google.protobuf.ByteString; +import com.google.protobuf.Struct; +import com.google.protobuf.Value; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentCardSignature; +import org.a2aproject.sdk.compat03.spec.AgentExtension; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.AgentProvider; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.AuthorizationCodeOAuthFlow; +import org.a2aproject.sdk.compat03.spec.ClientCredentialsOAuthFlow; +import org.a2aproject.sdk.compat03.spec.DataPart; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.FileContent; +import org.a2aproject.sdk.compat03.spec.FilePart; +import org.a2aproject.sdk.compat03.spec.FileWithBytes; +import org.a2aproject.sdk.compat03.spec.FileWithUri; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme; +import org.a2aproject.sdk.compat03.spec.ImplicitOAuthFlow; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.MutualTLSSecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuthFlows; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.PasswordOAuthFlow; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.SecurityScheme; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.jspecify.annotations.Nullable; + +/** + * Utility class to convert between GRPC and Spec objects. + */ +public class ProtoUtils { + + public static class ToProto { + + public static org.a2aproject.sdk.compat03.grpc.AgentCard agentCard(AgentCard agentCard) { + org.a2aproject.sdk.compat03.grpc.AgentCard.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCard.newBuilder(); + if (agentCard.protocolVersion() != null) { + builder.setProtocolVersion(agentCard.protocolVersion()); + } + if (agentCard.name() != null) { + builder.setName(agentCard.name()); + } + if (agentCard.description() != null) { + builder.setDescription(agentCard.description()); + } + if (agentCard.url() != null) { + builder.setUrl(agentCard.url()); + } + if (agentCard.preferredTransport() != null) { + builder.setPreferredTransport(agentCard.preferredTransport()); + } + if (agentCard.additionalInterfaces() != null) { + builder.addAllAdditionalInterfaces(agentCard.additionalInterfaces().stream().map(item -> agentInterface(item)).collect(Collectors.toList())); + } + if (agentCard.provider() != null) { + builder.setProvider(agentProvider(agentCard.provider())); + } + if (agentCard.version() != null) { + builder.setVersion(agentCard.version()); + } + if (agentCard.documentationUrl() != null) { + builder.setDocumentationUrl(agentCard.documentationUrl()); + } + if (agentCard.capabilities() != null) { + builder.setCapabilities(agentCapabilities(agentCard.capabilities())); + } + if (agentCard.securitySchemes() != null) { + builder.putAllSecuritySchemes( + agentCard.securitySchemes().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> securityScheme(e.getValue()))) + ); + } + if (agentCard.security() != null) { + builder.addAllSecurity(agentCard.security().stream().map(s -> { + org.a2aproject.sdk.compat03.grpc.Security.Builder securityBuilder = org.a2aproject.sdk.compat03.grpc.Security.newBuilder(); + s.forEach((key, value) -> { + org.a2aproject.sdk.compat03.grpc.StringList.Builder stringListBuilder = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + stringListBuilder.addAllList(value); + securityBuilder.putSchemes(key, stringListBuilder.build()); + }); + return securityBuilder.build(); + }).collect(Collectors.toList())); + } + if (agentCard.defaultInputModes() != null) { + builder.addAllDefaultInputModes(agentCard.defaultInputModes()); + } + if (agentCard.defaultOutputModes() != null) { + builder.addAllDefaultOutputModes(agentCard.defaultOutputModes()); + } + if (agentCard.skills() != null) { + builder.addAllSkills(agentCard.skills().stream().map(ToProto::agentSkill).collect(Collectors.toList())); + } + builder.setSupportsAuthenticatedExtendedCard(agentCard.supportsAuthenticatedExtendedCard()); + if (agentCard.signatures() != null) { + builder.addAllSignatures(agentCard.signatures().stream().map(ToProto::agentCardSignature).collect(Collectors.toList())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.Task task(Task task) { + org.a2aproject.sdk.compat03.grpc.Task.Builder builder = org.a2aproject.sdk.compat03.grpc.Task.newBuilder(); + builder.setId(task.getId()); + builder.setContextId(task.getContextId()); + builder.setStatus(taskStatus(task.getStatus())); + if (task.getArtifacts() != null) { + builder.addAllArtifacts(task.getArtifacts().stream().map(ToProto::artifact).collect(Collectors.toList())); + } + if (task.getHistory() != null) { + builder.addAllHistory(task.getHistory().stream().map(ToProto::message).collect(Collectors.toList())); + } + builder.setMetadata(struct(task.getMetadata())); + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.Message message(Message message) { + org.a2aproject.sdk.compat03.grpc.Message.Builder builder = org.a2aproject.sdk.compat03.grpc.Message.newBuilder(); + builder.setMessageId(message.getMessageId()); + if (message.getContextId() != null) { + builder.setContextId(message.getContextId()); + } + if (message.getTaskId() != null) { + builder.setTaskId(message.getTaskId()); + } + builder.setRole(role(message.getRole())); + if (message.getParts() != null) { + builder.addAllContent(message.getParts().stream().map(ToProto::part).collect(Collectors.toList())); + } + builder.setMetadata(struct(message.getMetadata())); + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig taskPushNotificationConfig(TaskPushNotificationConfig config) { + String id = config.pushNotificationConfig().id(); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(); + builder.setName("tasks/" + config.taskId() + "/pushNotificationConfigs" + (id == null ? "" : ('/' + id))); + builder.setPushNotificationConfig(pushNotificationConfig(config.pushNotificationConfig())); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.PushNotificationConfig pushNotificationConfig(PushNotificationConfig config) { + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.Builder builder = org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder(); + if (config.url() != null) { + builder.setUrl(config.url()); + } + if (config.token() != null) { + builder.setToken(config.token()); + } + if (config.authentication() != null) { + builder.setAuthentication(authenticationInfo(config.authentication())); + } + if (config.id() != null) { + builder.setId(config.id()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent taskArtifactUpdateEvent(TaskArtifactUpdateEvent event) { + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent.newBuilder(); + builder.setTaskId(event.getTaskId()); + builder.setContextId(event.getContextId()); + builder.setArtifact(artifact(event.getArtifact())); + if (event.isAppend() != null) { + builder.setAppend(event.isAppend()); + } + if (event.isLastChunk() != null) { + builder.setLastChunk(event.isLastChunk()); + } + if (event.getMetadata() != null) { + builder.setMetadata(struct(event.getMetadata())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent taskStatusUpdateEvent(TaskStatusUpdateEvent event) { + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent.newBuilder(); + builder.setTaskId(event.getTaskId()); + builder.setContextId(event.getContextId()); + builder.setStatus(taskStatus(event.getStatus())); + builder.setFinal(event.isFinal()); + if (event.getMetadata() != null) { + builder.setMetadata(struct(event.getMetadata())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Artifact artifact(Artifact artifact) { + org.a2aproject.sdk.compat03.grpc.Artifact.Builder builder = org.a2aproject.sdk.compat03.grpc.Artifact.newBuilder(); + if (artifact.artifactId() != null) { + builder.setArtifactId(artifact.artifactId()); + } + if (artifact.name() != null) { + builder.setName(artifact.name()); + } + if (artifact.description() != null) { + builder.setDescription(artifact.description()); + } + if (artifact.parts() != null) { + builder.addAllParts(artifact.parts().stream().map(ToProto::part).collect(Collectors.toList())); + } + if (artifact.metadata() != null) { + builder.setMetadata(struct(artifact.metadata())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Part part(Part part) { + org.a2aproject.sdk.compat03.grpc.Part.Builder builder = org.a2aproject.sdk.compat03.grpc.Part.newBuilder(); + if (part instanceof TextPart) { + builder.setText(((TextPart) part).getText()); + } else if (part instanceof FilePart) { + builder.setFile(filePart((FilePart) part)); + } else if (part instanceof DataPart) { + builder.setData(dataPart((DataPart) part)); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.FilePart filePart(FilePart filePart) { + org.a2aproject.sdk.compat03.grpc.FilePart.Builder builder = org.a2aproject.sdk.compat03.grpc.FilePart.newBuilder(); + FileContent fileContent = filePart.getFile(); + if (fileContent instanceof FileWithBytes) { + builder.setFileWithBytes(ByteString.copyFrom(((FileWithBytes) fileContent).bytes(), StandardCharsets.UTF_8)); + } else if (fileContent instanceof FileWithUri) { + builder.setFileWithUri(((FileWithUri) fileContent).uri()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.DataPart dataPart(DataPart dataPart) { + org.a2aproject.sdk.compat03.grpc.DataPart.Builder builder = org.a2aproject.sdk.compat03.grpc.DataPart.newBuilder(); + if (dataPart.getData() != null) { + builder.setData(struct(dataPart.getData())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.Role role(Message.Role role) { + if (role == null) { + return org.a2aproject.sdk.compat03.grpc.Role.ROLE_UNSPECIFIED; + } + return switch (role) { + case USER -> + org.a2aproject.sdk.compat03.grpc.Role.ROLE_USER; + case AGENT -> + org.a2aproject.sdk.compat03.grpc.Role.ROLE_AGENT; + }; + } + + private static org.a2aproject.sdk.compat03.grpc.TaskStatus taskStatus(TaskStatus taskStatus) { + org.a2aproject.sdk.compat03.grpc.TaskStatus.Builder builder = org.a2aproject.sdk.compat03.grpc.TaskStatus.newBuilder(); + if (taskStatus.state() != null) { + builder.setState(taskState(taskStatus.state())); + } + if (taskStatus.message() != null) { + builder.setUpdate(message(taskStatus.message())); + } + if (taskStatus.timestamp() != null) { + Instant instant = taskStatus.timestamp().toInstant(); + builder.setTimestamp(com.google.protobuf.Timestamp.newBuilder().setSeconds(instant.getEpochSecond()).setNanos(instant.getNano()).build()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.TaskState taskState(TaskState taskState) { + if (taskState == null) { + return org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED; + } + return switch (taskState) { + case SUBMITTED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED; + case WORKING -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_WORKING; + case INPUT_REQUIRED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_INPUT_REQUIRED; + case AUTH_REQUIRED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_AUTH_REQUIRED; + case COMPLETED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_COMPLETED; + case CANCELED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_CANCELLED; + case FAILED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_FAILED; + case REJECTED -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_REJECTED; + default -> + org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_UNSPECIFIED; + }; + } + + private static org.a2aproject.sdk.compat03.grpc.AuthenticationInfo authenticationInfo(PushNotificationAuthenticationInfo pushNotificationAuthenticationInfo) { + org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.Builder builder = org.a2aproject.sdk.compat03.grpc.AuthenticationInfo.newBuilder(); + if (pushNotificationAuthenticationInfo.schemes() != null) { + builder.addAllSchemes(pushNotificationAuthenticationInfo.schemes()); + } + if (pushNotificationAuthenticationInfo.credentials() != null) { + builder.setCredentials(pushNotificationAuthenticationInfo.credentials()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration messageSendConfiguration(MessageSendConfiguration messageSendConfiguration) { + org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration.newBuilder(); + if (messageSendConfiguration.acceptedOutputModes() != null) { + builder.addAllAcceptedOutputModes(messageSendConfiguration.acceptedOutputModes()); + } + if (messageSendConfiguration.historyLength() != null) { + builder.setHistoryLength(messageSendConfiguration.historyLength()); + } + if (messageSendConfiguration.pushNotificationConfig() != null) { + builder.setPushNotification(pushNotificationConfig(messageSendConfiguration.pushNotificationConfig())); + } + builder.setBlocking(messageSendConfiguration.blocking()); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentProvider agentProvider(AgentProvider agentProvider) { + org.a2aproject.sdk.compat03.grpc.AgentProvider.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentProvider.newBuilder(); + builder.setOrganization(agentProvider.organization()); + builder.setUrl(agentProvider.url()); + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentCapabilities agentCapabilities(AgentCapabilities agentCapabilities) { + org.a2aproject.sdk.compat03.grpc.AgentCapabilities.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCapabilities.newBuilder(); + builder.setStreaming(agentCapabilities.streaming()); + builder.setPushNotifications(agentCapabilities.pushNotifications()); + if (agentCapabilities.extensions() != null) { + builder.addAllExtensions(agentCapabilities.extensions().stream().map(ToProto::agentExtension).collect(Collectors.toList())); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageRequest sendMessageRequest(MessageSendParams request) { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + builder.setRequest(message(request.message())); + if (request.configuration() != null) { + builder.setConfiguration(messageSendConfiguration(request.configuration())); + } + if (request.metadata() != null && ! request.metadata().isEmpty()) { + builder.setMetadata(struct(request.metadata())); + } + return builder.build(); + } + private static org.a2aproject.sdk.compat03.grpc.AgentExtension agentExtension(AgentExtension agentExtension) { + org.a2aproject.sdk.compat03.grpc.AgentExtension.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentExtension.newBuilder(); + if (agentExtension.description() != null) { + builder.setDescription(agentExtension.description()); + } + if (agentExtension.params() != null) { + builder.setParams(struct(agentExtension.params())); + } + builder.setRequired(agentExtension.required()); + if (agentExtension.uri() != null) { + builder.setUri(agentExtension.uri()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentSkill agentSkill(AgentSkill agentSkill) { + org.a2aproject.sdk.compat03.grpc.AgentSkill.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentSkill.newBuilder(); + if (agentSkill.id() != null) { + builder.setId(agentSkill.id()); + } + if (agentSkill.name() != null) { + builder.setName(agentSkill.name()); + } + if (agentSkill.description() != null) { + builder.setDescription(agentSkill.description()); + } + if (agentSkill.tags() != null) { + builder.addAllTags(agentSkill.tags()); + } + if (agentSkill.examples() != null) { + builder.addAllExamples(agentSkill.examples()); + } + if (agentSkill.inputModes() != null) { + builder.addAllInputModes(agentSkill.inputModes()); + } + if (agentSkill.outputModes() != null) { + builder.addAllOutputModes(agentSkill.outputModes()); + } + if (agentSkill.security() != null) { + builder.addAllSecurity(agentSkill.security().stream().map(s -> { + org.a2aproject.sdk.compat03.grpc.Security.Builder securityBuilder = org.a2aproject.sdk.compat03.grpc.Security.newBuilder(); + s.forEach((key, value) -> { + org.a2aproject.sdk.compat03.grpc.StringList.Builder stringListBuilder = org.a2aproject.sdk.compat03.grpc.StringList.newBuilder(); + stringListBuilder.addAllList(value); + securityBuilder.putSchemes(key, stringListBuilder.build()); + }); + return securityBuilder.build(); + }).collect(Collectors.toList())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentCardSignature agentCardSignature(AgentCardSignature agentCardSignature) { + org.a2aproject.sdk.compat03.grpc.AgentCardSignature.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentCardSignature.newBuilder(); + builder.setProtected(agentCardSignature.protectedHeader()); + builder.setSignature(agentCardSignature.signature()); + if (agentCardSignature.header() != null) { + builder.setHeader(struct(agentCardSignature.header())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.SecurityScheme securityScheme(SecurityScheme securityScheme) { + org.a2aproject.sdk.compat03.grpc.SecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.SecurityScheme.newBuilder(); + if (securityScheme instanceof APIKeySecurityScheme) { + builder.setApiKeySecurityScheme(apiKeySecurityScheme((APIKeySecurityScheme) securityScheme)); + } else if (securityScheme instanceof HTTPAuthSecurityScheme) { + builder.setHttpAuthSecurityScheme(httpAuthSecurityScheme((HTTPAuthSecurityScheme) securityScheme)); + } else if (securityScheme instanceof OAuth2SecurityScheme) { + builder.setOauth2SecurityScheme(oauthSecurityScheme((OAuth2SecurityScheme) securityScheme)); + } else if (securityScheme instanceof OpenIdConnectSecurityScheme) { + builder.setOpenIdConnectSecurityScheme(openIdConnectSecurityScheme((OpenIdConnectSecurityScheme) securityScheme)); + } else if (securityScheme instanceof MutualTLSSecurityScheme) { + builder.setMtlsSecurityScheme(mutualTlsSecurityScheme((MutualTLSSecurityScheme) securityScheme)); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme apiKeySecurityScheme(APIKeySecurityScheme apiKeySecurityScheme) { + org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.APIKeySecurityScheme.newBuilder(); + if (apiKeySecurityScheme.getDescription() != null) { + builder.setDescription(apiKeySecurityScheme.getDescription()); + } + if (apiKeySecurityScheme.getIn() != null) { + builder.setLocation(apiKeySecurityScheme.getIn()); + } + if (apiKeySecurityScheme.getName() != null) { + builder.setName(apiKeySecurityScheme.getName()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme httpAuthSecurityScheme(HTTPAuthSecurityScheme httpAuthSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.HTTPAuthSecurityScheme.newBuilder(); + if (httpAuthSecurityScheme.getBearerFormat() != null) { + builder.setBearerFormat(httpAuthSecurityScheme.getBearerFormat()); + } + if (httpAuthSecurityScheme.getDescription() != null) { + builder.setDescription(httpAuthSecurityScheme.getDescription()); + } + if (httpAuthSecurityScheme.getScheme() != null) { + builder.setScheme(httpAuthSecurityScheme.getScheme()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme oauthSecurityScheme(OAuth2SecurityScheme oauth2SecurityScheme) { + org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.OAuth2SecurityScheme.newBuilder(); + if (oauth2SecurityScheme.getDescription() != null) { + builder.setDescription(oauth2SecurityScheme.getDescription()); + } + if (oauth2SecurityScheme.getFlows() != null) { + builder.setFlows(oauthFlows(oauth2SecurityScheme.getFlows())); + } + if (oauth2SecurityScheme.getOauth2MetadataUrl() != null) { + builder.setOauth2MetadataUrl(oauth2SecurityScheme.getOauth2MetadataUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OAuthFlows oauthFlows(OAuthFlows oAuthFlows) { + org.a2aproject.sdk.compat03.grpc.OAuthFlows.Builder builder = org.a2aproject.sdk.compat03.grpc.OAuthFlows.newBuilder(); + if (oAuthFlows.authorizationCode() != null) { + builder.setAuthorizationCode(authorizationCodeOAuthFlow(oAuthFlows.authorizationCode())); + } + if (oAuthFlows.clientCredentials() != null) { + builder.setClientCredentials(clientCredentialsOAuthFlow(oAuthFlows.clientCredentials())); + } + if (oAuthFlows.implicit() != null) { + builder.setImplicit(implicitOAuthFlow(oAuthFlows.implicit())); + } + if (oAuthFlows.password() != null) { + builder.setPassword(passwordOAuthFlow(oAuthFlows.password())); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow authorizationCodeOAuthFlow(AuthorizationCodeOAuthFlow authorizationCodeOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.AuthorizationCodeOAuthFlow.newBuilder(); + if (authorizationCodeOAuthFlow.authorizationUrl() != null) { + builder.setAuthorizationUrl(authorizationCodeOAuthFlow.authorizationUrl()); + } + if (authorizationCodeOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(authorizationCodeOAuthFlow.refreshUrl()); + } + if (authorizationCodeOAuthFlow.scopes() != null) { + builder.putAllScopes(authorizationCodeOAuthFlow.scopes()); + } + if (authorizationCodeOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(authorizationCodeOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + public static org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse listTaskPushNotificationConfigResponse(List configs) { + List confs = new ArrayList<>(configs.size()); + for(TaskPushNotificationConfig config: configs) { + confs.add(taskPushNotificationConfig(config)); + } + return org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder().addAllConfigs(confs).build(); + } + + private static org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow clientCredentialsOAuthFlow(ClientCredentialsOAuthFlow clientCredentialsOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.ClientCredentialsOAuthFlow.newBuilder(); + if (clientCredentialsOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(clientCredentialsOAuthFlow.refreshUrl()); + } + if (clientCredentialsOAuthFlow.scopes() != null) { + builder.putAllScopes(clientCredentialsOAuthFlow.scopes()); + } + if (clientCredentialsOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(clientCredentialsOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow implicitOAuthFlow(ImplicitOAuthFlow implicitOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.ImplicitOAuthFlow.newBuilder(); + if (implicitOAuthFlow.authorizationUrl() != null) { + builder.setAuthorizationUrl(implicitOAuthFlow.authorizationUrl()); + } + if (implicitOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(implicitOAuthFlow.refreshUrl()); + } + if (implicitOAuthFlow.scopes() != null) { + builder.putAllScopes(implicitOAuthFlow.scopes()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow passwordOAuthFlow(PasswordOAuthFlow passwordOAuthFlow) { + org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.Builder builder = org.a2aproject.sdk.compat03.grpc.PasswordOAuthFlow.newBuilder(); + if (passwordOAuthFlow.refreshUrl() != null) { + builder.setRefreshUrl(passwordOAuthFlow.refreshUrl()); + } + if (passwordOAuthFlow.scopes() != null) { + builder.putAllScopes(passwordOAuthFlow.scopes()); + } + if (passwordOAuthFlow.tokenUrl() != null) { + builder.setTokenUrl(passwordOAuthFlow.tokenUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme openIdConnectSecurityScheme(OpenIdConnectSecurityScheme openIdConnectSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.OpenIdConnectSecurityScheme.newBuilder(); + if (openIdConnectSecurityScheme.getDescription() != null) { + builder.setDescription(openIdConnectSecurityScheme.getDescription()); + } + if (openIdConnectSecurityScheme.getOpenIdConnectUrl() != null) { + builder.setOpenIdConnectUrl(openIdConnectSecurityScheme.getOpenIdConnectUrl()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme mutualTlsSecurityScheme(MutualTLSSecurityScheme mutualTlsSecurityScheme) { + org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.Builder builder = org.a2aproject.sdk.compat03.grpc.MutualTlsSecurityScheme.newBuilder(); + if (mutualTlsSecurityScheme.getDescription() != null) { + builder.setDescription(mutualTlsSecurityScheme.getDescription()); + } + return builder.build(); + } + + private static org.a2aproject.sdk.compat03.grpc.AgentInterface agentInterface(AgentInterface agentInterface) { + org.a2aproject.sdk.compat03.grpc.AgentInterface.Builder builder = org.a2aproject.sdk.compat03.grpc.AgentInterface.newBuilder(); + if (agentInterface.transport() != null) { + builder.setTransport(agentInterface.transport()); + } + if (agentInterface.url() != null) { + builder.setUrl(agentInterface.url()); + } + return builder.build(); + } + + public static Struct struct(Map map) { + Struct.Builder structBuilder = Struct.newBuilder(); + if (map != null) { + map.forEach((k, v) -> structBuilder.putFields(k, value(v))); + } + return structBuilder.build(); + } + + private static Value value(Object value) { + Value.Builder valueBuilder = Value.newBuilder(); + if (value instanceof String) { + valueBuilder.setStringValue((String) value); + } else if (value instanceof Number) { + valueBuilder.setNumberValue(((Number) value).doubleValue()); + } else if (value instanceof Boolean) { + valueBuilder.setBoolValue((Boolean) value); + } else if (value instanceof Map) { + valueBuilder.setStructValue(struct((Map) value)); + } else if (value instanceof List) { + valueBuilder.setListValue(listValue((List) value)); + } + return valueBuilder.build(); + } + + private static com.google.protobuf.ListValue listValue(List list) { + com.google.protobuf.ListValue.Builder listValueBuilder = com.google.protobuf.ListValue.newBuilder(); + if (list != null) { + list.forEach(o -> listValueBuilder.addValues(value(o))); + } + return listValueBuilder.build(); + } + + public static StreamResponse streamResponse(StreamingEventKind streamingEventKind) { + if (streamingEventKind instanceof TaskStatusUpdateEvent) { + return StreamResponse.newBuilder() + .setStatusUpdate(taskStatusUpdateEvent((TaskStatusUpdateEvent) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof TaskArtifactUpdateEvent) { + return StreamResponse.newBuilder() + .setArtifactUpdate(taskArtifactUpdateEvent((TaskArtifactUpdateEvent) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof Message) { + return StreamResponse.newBuilder() + .setMsg(message((Message) streamingEventKind)) + .build(); + } else if (streamingEventKind instanceof Task) { + return StreamResponse.newBuilder() + .setTask(task((Task) streamingEventKind)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + streamingEventKind); + } + } + + public static org.a2aproject.sdk.compat03.grpc.SendMessageResponse taskOrMessage(EventKind eventKind) { + if (eventKind instanceof Task) { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + .setTask(task((Task) eventKind)) + .build(); + } else if (eventKind instanceof Message) { + return org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder() + .setMsg(message((Message) eventKind)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + eventKind); + } + } + + public static org.a2aproject.sdk.compat03.grpc.StreamResponse taskOrMessageStream(StreamingEventKind eventKind) { + if (eventKind instanceof Task task) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setTask(task(task)) + .build(); + } else if (eventKind instanceof Message msg) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setMsg(message(msg)) + .build(); + } else if (eventKind instanceof TaskArtifactUpdateEvent update) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setArtifactUpdate(taskArtifactUpdateEvent(update)) + .build(); + } else if (eventKind instanceof TaskStatusUpdateEvent update) { + return org.a2aproject.sdk.compat03.grpc.StreamResponse.newBuilder() + .setStatusUpdate(taskStatusUpdateEvent(update)) + .build(); + } else { + throw new IllegalArgumentException("Unsupported event type: " + eventKind); + } + } + + } + + public static class FromProto { + + public static TaskQueryParams taskQueryParams(org.a2aproject.sdk.compat03.grpc.GetTaskRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskQueryParams(id, request.getHistoryLength()); + } + + public static TaskIdParams taskIdParams(org.a2aproject.sdk.compat03.grpc.CancelTaskRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskIdParams(id); + } + + public static MessageSendParams messageSendParams(org.a2aproject.sdk.compat03.grpc.SendMessageRequestOrBuilder request) { + MessageSendParams.Builder builder = new MessageSendParams.Builder(); + builder.message(message(request.getRequest())); + if (request.hasConfiguration()) { + builder.configuration(messageSendConfiguration(request.getConfiguration())); + } + if (request.hasMetadata()) { + builder.metadata(struct(request.getMetadata())); + } + return builder.build(); + } + + public static TaskPushNotificationConfig taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequestOrBuilder request) { + return taskPushNotificationConfig(request.getConfig(), true); + } + + public static TaskPushNotificationConfig taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder config) { + return taskPushNotificationConfig(config, false); + } + + private static TaskPushNotificationConfig taskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfigOrBuilder config, boolean create) { + String name = config.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + String taskId = parts[1]; + String configId = ""; + if (create) { + if (parts.length < 3) { + throw new IllegalArgumentException("Invalid name format for TaskPushNotificationConfig: " + name); + } + if (parts.length == 4) { + configId = parts[3]; + } else { + configId = taskId; + } + } else { + if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for TaskPushNotificationConfig: " + name); + } + configId = parts[3]; + } + PushNotificationConfig pnc = pushNotification(config.getPushNotificationConfig(), configId); + return new TaskPushNotificationConfig(taskId, pnc); + } + + public static GetTaskPushNotificationConfigParams getTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequestOrBuilder request) { + String name = request.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + String taskId = parts[1]; + String configId; + if (parts.length == 2) { + configId = taskId; + } else if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for GetTaskPushNotificationConfigRequest: " + name); + } else { + configId = parts[3]; + } + return new GetTaskPushNotificationConfigParams(taskId, configId); + } + + public static TaskIdParams taskIdParams(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequestOrBuilder request) { + String name = request.getName(); + String id = name.substring(name.lastIndexOf('/') + 1); + return new TaskIdParams(id); + } + + public static List listTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponseOrBuilder response) { + List configs = response.getConfigsList(); + List result = new ArrayList<>(configs.size()); + for(org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig config : configs) { + result.add(taskPushNotificationConfig(config, false)); + } + return result; + } + + public static ListTaskPushNotificationConfigParams listTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequestOrBuilder request) { + String parent = request.getParent(); + String id = parent.substring(parent.lastIndexOf('/') + 1); + return new ListTaskPushNotificationConfigParams(id); + } + + public static DeleteTaskPushNotificationConfigParams deleteTaskPushNotificationConfigParams(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequestOrBuilder request) { + String name = request.getName(); // "tasks/{id}/pushNotificationConfigs/{push_id}" + String[] parts = name.split("/"); + if (parts.length < 4) { + throw new IllegalArgumentException("Invalid name format for DeleteTaskPushNotificationConfigRequest: " + name); + } + String taskId = parts[1]; + String configId = parts[3]; + return new DeleteTaskPushNotificationConfigParams(taskId, configId); + } + + private static AgentExtension agentExtension(org.a2aproject.sdk.compat03.grpc.AgentExtensionOrBuilder agentExtension) { + return new AgentExtension( + agentExtension.getDescription(), + struct(agentExtension.getParams()), + agentExtension.getRequired(), + agentExtension.getUri() + ); + } + + private static MessageSendConfiguration messageSendConfiguration(org.a2aproject.sdk.compat03.grpc.SendMessageConfigurationOrBuilder sendMessageConfiguration) { + return new MessageSendConfiguration( + sendMessageConfiguration.getAcceptedOutputModesList().isEmpty() ? null : + new ArrayList<>(sendMessageConfiguration.getAcceptedOutputModesList()), + sendMessageConfiguration.getHistoryLength(), + pushNotification(sendMessageConfiguration.getPushNotification()), + sendMessageConfiguration.getBlocking() + ); + } + + private static @Nullable PushNotificationConfig pushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder pushNotification, String configId) { + if(pushNotification == null || pushNotification.getDefaultInstanceForType().equals(pushNotification)) { + return null; + } + return new PushNotificationConfig( + pushNotification.getUrl(), + pushNotification.getToken().isEmpty() ? null : pushNotification.getToken(), + pushNotification.hasAuthentication() ? authenticationInfo(pushNotification.getAuthentication()) : null, + pushNotification.getId().isEmpty() ? configId : pushNotification.getId() + ); + } + + private static @Nullable PushNotificationConfig pushNotification(org.a2aproject.sdk.compat03.grpc.PushNotificationConfigOrBuilder pushNotification) { + return pushNotification(pushNotification, pushNotification.getId()); + } + + private static PushNotificationAuthenticationInfo authenticationInfo(org.a2aproject.sdk.compat03.grpc.AuthenticationInfoOrBuilder authenticationInfo) { + return new PushNotificationAuthenticationInfo( + new ArrayList<>(authenticationInfo.getSchemesList()), + authenticationInfo.getCredentials() + ); + } + + public static Task task(org.a2aproject.sdk.compat03.grpc.TaskOrBuilder task) { + return new Task( + task.getId(), + task.getContextId(), + taskStatus(task.getStatus()), + task.getArtifactsList().stream().map(item -> artifact(item)).collect(Collectors.toList()), + task.getHistoryList().stream().map(item -> message(item)).collect(Collectors.toList()), + struct(task.getMetadata()) + ); + } + + public static Message message(org.a2aproject.sdk.compat03.grpc.MessageOrBuilder message) { + if (message.getMessageId().isEmpty()) { + throw new InvalidParamsError(); + } + + return new Message( + role(message.getRole()), + message.getContentList().stream().map(item -> part(item)).collect(Collectors.toList()), + message.getMessageId().isEmpty() ? null : message.getMessageId(), + message.getContextId().isEmpty() ? null : message.getContextId(), + message.getTaskId().isEmpty() ? null : message.getTaskId(), + null, // referenceTaskIds is not in grpc message + struct(message.getMetadata()), + message.getExtensionsList().isEmpty() ? null : message.getExtensionsList() + ); + } + + public static TaskStatusUpdateEvent taskStatusUpdateEvent(org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEventOrBuilder taskStatusUpdateEvent) { + return new TaskStatusUpdateEvent.Builder() + .taskId(taskStatusUpdateEvent.getTaskId()) + .status(taskStatus(taskStatusUpdateEvent.getStatus())) + .contextId(taskStatusUpdateEvent.getContextId()) + .isFinal(taskStatusUpdateEvent.getFinal()) + .metadata(struct(taskStatusUpdateEvent.getMetadata())) + .build(); + } + + public static TaskArtifactUpdateEvent taskArtifactUpdateEvent(org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEventOrBuilder taskArtifactUpdateEvent) { + return new TaskArtifactUpdateEvent.Builder() + .taskId(taskArtifactUpdateEvent.getTaskId()) + .append(taskArtifactUpdateEvent.getAppend()) + .lastChunk(taskArtifactUpdateEvent.getLastChunk()) + .artifact(artifact(taskArtifactUpdateEvent.getArtifact())) + .contextId(taskArtifactUpdateEvent.getContextId()) + .metadata(struct(taskArtifactUpdateEvent.getMetadata())) + .build(); + } + + private static Artifact artifact(org.a2aproject.sdk.compat03.grpc.ArtifactOrBuilder artifact) { + return new Artifact( + artifact.getArtifactId(), + artifact.getName(), + artifact.getDescription(), + artifact.getPartsList().stream().map(item -> part(item)).collect(Collectors.toList()), + struct(artifact.getMetadata()), + artifact.getExtensionsList().isEmpty() ? null : artifact.getExtensionsList() + ); + } + + private static Part part(org.a2aproject.sdk.compat03.grpc.PartOrBuilder part) { + if (part.hasText()) { + return textPart(part.getText()); + } else if (part.hasFile()) { + return filePart(part.getFile()); + } else if (part.hasData()) { + return dataPart(part.getData()); + } + throw new InvalidRequestError(); + } + + private static TextPart textPart(String text) { + return new TextPart(text); + } + + private static FilePart filePart(org.a2aproject.sdk.compat03.grpc.FilePartOrBuilder filePart) { + if (filePart.hasFileWithBytes()) { + return new FilePart(new FileWithBytes(filePart.getMimeType(), null, filePart.getFileWithBytes().toStringUtf8())); + } else if (filePart.hasFileWithUri()) { + return new FilePart(new FileWithUri(filePart.getMimeType(), null, filePart.getFileWithUri())); + } + throw new InvalidRequestError(); + } + + private static DataPart dataPart(org.a2aproject.sdk.compat03.grpc.DataPartOrBuilder dataPart) { + return new DataPart(struct(dataPart.getData())); + } + + private static @Nullable TaskStatus taskStatus(org.a2aproject.sdk.compat03.grpc.TaskStatusOrBuilder taskStatus) { + TaskState state = taskState(taskStatus.getState()); + if (state == null) { + return null; + } + return new TaskStatus( + taskState(taskStatus.getState()), + taskStatus.hasUpdate() ? message(taskStatus.getUpdateOrBuilder()) : null, + OffsetDateTime.ofInstant(Instant.ofEpochSecond(taskStatus.getTimestamp().getSeconds(), taskStatus.getTimestamp().getNanos()), ZoneOffset.UTC) + ); + } + + private static Message.@Nullable Role role(org.a2aproject.sdk.compat03.grpc.Role role) { + if (role == null) { + return null; + } + return switch (role) { + case ROLE_USER -> + Message.Role.USER; + case ROLE_AGENT -> + Message.Role.AGENT; + default -> + throw new InvalidRequestError(); + }; + } + + private static @Nullable TaskState taskState(org.a2aproject.sdk.compat03.grpc.TaskState taskState) { + if (taskState == null) { + return null; + } + return switch (taskState) { + case TASK_STATE_SUBMITTED -> + TaskState.SUBMITTED; + case TASK_STATE_WORKING -> + TaskState.WORKING; + case TASK_STATE_INPUT_REQUIRED -> + TaskState.INPUT_REQUIRED; + case TASK_STATE_AUTH_REQUIRED -> + TaskState.AUTH_REQUIRED; + case TASK_STATE_COMPLETED -> + TaskState.COMPLETED; + case TASK_STATE_CANCELLED -> + TaskState.CANCELED; + case TASK_STATE_FAILED -> + TaskState.FAILED; + case TASK_STATE_REJECTED -> + TaskState.REJECTED; + case TASK_STATE_UNSPECIFIED -> + null; + case UNRECOGNIZED -> + null; + }; + } + + private static @Nullable Map struct(Struct struct) { + if (struct == null || struct.getFieldsCount() == 0) { + return null; + } + return struct.getFieldsMap().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> value(e.getValue()))); + } + + private static @Nullable Object value(Value value) { + switch (value.getKindCase()) { + case STRUCT_VALUE: + return struct(value.getStructValue()); + case LIST_VALUE: + return value.getListValue().getValuesList().stream() + .map(FromProto::value) + .collect(Collectors.toList()); + case BOOL_VALUE: + return value.getBoolValue(); + case NUMBER_VALUE: + return value.getNumberValue(); + case STRING_VALUE: + return value.getStringValue(); + case NULL_VALUE: + default: + throw new InvalidRequestError(); + } + } + } + +} diff --git a/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java new file mode 100644 index 000000000..bd0d8d936 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/java/org/a2aproject/sdk/compat03/grpc/utils/package-info.java @@ -0,0 +1,5 @@ +@NullMarked +package org.a2aproject.sdk.compat03.grpc.utils; + +import org.jspecify.annotations.NullMarked; + diff --git a/compat-0.3/spec-grpc/src/main/proto/a2a.proto b/compat-0.3/spec-grpc/src/main/proto/a2a.proto new file mode 100644 index 000000000..89b21a258 --- /dev/null +++ b/compat-0.3/spec-grpc/src/main/proto/a2a.proto @@ -0,0 +1,717 @@ +// Older protoc compilers don't understand edition yet. +syntax = "proto3"; +package a2a.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +// Copied from https://github.com/a2aproject/A2A/blob/v0.3.0/specification/grpc/a2a.proto +// The only change is the 'java_package' update + +option csharp_namespace = "A2a.V1"; +option go_package = "google.golang.org/a2a/v1"; +option java_multiple_files = true; +option java_outer_classname = "A2A"; +// Update package from the spec version +option java_package = "org.a2aproject.sdk.compat03.grpc"; + +// A2AService defines the gRPC version of the A2A protocol. This has a slightly +// different shape than the JSONRPC version to better conform to AIP-127, +// where appropriate. The nouns are AgentCard, Message, Task and +// TaskPushNotificationConfig. +// - Messages are not a standard resource so there is no get/delete/update/list +// interface, only a send and stream custom methods. +// - Tasks have a get interface and custom cancel and subscribe methods. +// - TaskPushNotificationConfig are a resource whose parent is a task. +// They have get, list and create methods. +// - AgentCard is a static resource with only a get method. +// fields are not present as they don't comply with AIP rules, and the +// optional history_length on the get task method is not present as it also +// violates AIP-127 and AIP-131. +service A2AService { + // Send a message to the agent. This is a blocking call that will return the + // task once it is completed, or a LRO if requested. + rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) { + option (google.api.http) = { + post: "/v1/message:send" + body: "*" + }; + } + // SendStreamingMessage is a streaming call that will return a stream of + // task update events until the Task is in an interrupted or terminal state. + rpc SendStreamingMessage(SendMessageRequest) returns (stream StreamResponse) { + option (google.api.http) = { + post: "/v1/message:stream" + body: "*" + }; + } + + // Get the current state of a task from the agent. + rpc GetTask(GetTaskRequest) returns (Task) { + option (google.api.http) = { + get: "/v1/{name=tasks/*}" + }; + option (google.api.method_signature) = "name"; + } + // Cancel a task from the agent. If supported one should expect no + // more task updates for the task. + rpc CancelTask(CancelTaskRequest) returns (Task) { + option (google.api.http) = { + post: "/v1/{name=tasks/*}:cancel" + body: "*" + }; + } + // TaskSubscription is a streaming call that will return a stream of task + // update events. This attaches the stream to an existing in process task. + // If the task is complete the stream will return the completed task (like + // GetTask) and close the stream. + rpc TaskSubscription(TaskSubscriptionRequest) + returns (stream StreamResponse) { + option (google.api.http) = { + get: "/v1/{name=tasks/*}:subscribe" + }; + } + + // Set a push notification config for a task. + rpc CreateTaskPushNotificationConfig(CreateTaskPushNotificationConfigRequest) + returns (TaskPushNotificationConfig) { + option (google.api.http) = { + post: "/v1/{parent=task/*/pushNotificationConfigs}" + body: "config" + }; + option (google.api.method_signature) = "parent,config"; + } + // Get a push notification config for a task. + rpc GetTaskPushNotificationConfig(GetTaskPushNotificationConfigRequest) + returns (TaskPushNotificationConfig) { + option (google.api.http) = { + get: "/v1/{name=tasks/*/pushNotificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } + // Get a list of push notifications configured for a task. + rpc ListTaskPushNotificationConfig(ListTaskPushNotificationConfigRequest) + returns (ListTaskPushNotificationConfigResponse) { + option (google.api.http) = { + get: "/v1/{parent=tasks/*}/pushNotificationConfigs" + }; + option (google.api.method_signature) = "parent"; + } + // GetAgentCard returns the agent card for the agent. + rpc GetAgentCard(GetAgentCardRequest) returns (AgentCard) { + option (google.api.http) = { + get: "/v1/card" + }; + } + // Delete a push notification config for a task. + rpc DeleteTaskPushNotificationConfig(DeleteTaskPushNotificationConfigRequest) + returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=tasks/*/pushNotificationConfigs/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +///////// Data Model //////////// + +// Configuration of a send message request. +message SendMessageConfiguration { + // The output modes that the agent is expected to respond with. + repeated string accepted_output_modes = 1; + // A configuration of a webhook that can be used to receive updates + PushNotificationConfig push_notification = 2; + // The maximum number of messages to include in the history. if 0, the + // history will be unlimited. + int32 history_length = 3; + // If true, the message will be blocking until the task is completed. If + // false, the message will be non-blocking and the task will be returned + // immediately. It is the caller's responsibility to check for any task + // updates. + bool blocking = 4; +} + +// Task is the core unit of action for A2A. It has a current status +// and when results are created for the task they are stored in the +// artifact. If there are multiple turns for a task, these are stored in +// history. +message Task { + // Unique identifier for a task, created by the A2A server. + string id = 1; + // Unique identifier for the contextual collection of interactions (tasks + // and messages). Created by the A2A server. + string context_id = 2; + // The current status of a Task, including state and a message. + TaskStatus status = 3; + // A set of output artifacts for a Task. + repeated Artifact artifacts = 4; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // The history of interactions from a task. + repeated Message history = 5; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // A key/value object to store custom metadata about a task. + google.protobuf.Struct metadata = 6; +} + +// The set of states a Task can be in. +enum TaskState { + TASK_STATE_UNSPECIFIED = 0; + // Represents the status that acknowledges a task is created + TASK_STATE_SUBMITTED = 1; + // Represents the status that a task is actively being processed + TASK_STATE_WORKING = 2; + // Represents the status a task is finished. This is a terminal state + TASK_STATE_COMPLETED = 3; + // Represents the status a task is done but failed. This is a terminal state + TASK_STATE_FAILED = 4; + // Represents the status a task was cancelled before it finished. + // This is a terminal state. + TASK_STATE_CANCELLED = 5; + // Represents the status that the task requires information to complete. + // This is an interrupted state. + TASK_STATE_INPUT_REQUIRED = 6; + // Represents the status that the agent has decided to not perform the task. + // This may be done during initial task creation or later once an agent + // has determined it can't or won't proceed. This is a terminal state. + TASK_STATE_REJECTED = 7; + // Represents the state that some authentication is needed from the upstream + // client. Authentication is expected to come out-of-band thus this is not + // an interrupted or terminal state. + TASK_STATE_AUTH_REQUIRED = 8; +} + +// A container for the status of a task +message TaskStatus { + // The current state of this task + TaskState state = 1; + // A message associated with the status. + Message update = 2 [json_name = "message"]; + // Timestamp when the status was recorded. + // Example: "2023-10-27T10:00:00Z" + google.protobuf.Timestamp timestamp = 3; +} + +// Part represents a container for a section of communication content. +// Parts can be purely textual, some sort of file (image, video, etc) or +// a structured data blob (i.e. JSON). +message Part { + oneof part { + string text = 1; + FilePart file = 2; + DataPart data = 3; + } +} + +// FilePart represents the different ways files can be provided. If files are +// small, directly feeding the bytes is supported via file_with_bytes. If the +// file is large, the agent should read the content as appropriate directly +// from the file_with_uri source. +message FilePart { + oneof file { + string file_with_uri = 1; + bytes file_with_bytes = 2; + } + string mime_type = 3; +} + +// DataPart represents a structured blob. This is most commonly a JSON payload. +message DataPart { + google.protobuf.Struct data = 1; +} + +enum Role { + ROLE_UNSPECIFIED = 0; + // USER role refers to communication from the client to the server. + ROLE_USER = 1; + // AGENT role refers to communication from the server to the client. + ROLE_AGENT = 2; +} + +// Message is one unit of communication between client and server. It is +// associated with a context and optionally a task. Since the server is +// responsible for the context definition, it must always provide a context_id +// in its messages. The client can optionally provide the context_id if it +// knows the context to associate the message to. Similarly for task_id, +// except the server decides if a task is created and whether to include the +// task_id. +message Message { + // The message id of the message. This is required and created by the + // message creator. + string message_id = 1; + // The context id of the message. This is optional and if set, the message + // will be associated with the given context. + string context_id = 2; + // The task id of the message. This is optional and if set, the message + // will be associated with the given task. + string task_id = 3; + // A role for the message. + Role role = 4; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Content is the container of the message content. + repeated Part content = 5; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // Any optional metadata to provide along with the message. + google.protobuf.Struct metadata = 6; + // The URIs of extensions that are present or contributed to this Message. + repeated string extensions = 7; +} + +// Artifacts are the container for task completed results. These are similar +// to Messages but are intended to be the product of a task, as opposed to +// point-to-point communication. +message Artifact { + // Unique id for the artifact. It must be at least unique within a task. + string artifact_id = 1; + // A human readable name for the artifact. + string name = 3; + // A human readable description of the artifact, optional. + string description = 4; + // The content of the artifact. + repeated Part parts = 5; + // Optional metadata included with the artifact. + google.protobuf.Struct metadata = 6; + // The URIs of extensions that are present or contributed to this Artifact. + repeated string extensions = 7; +} + +// TaskStatusUpdateEvent is a delta even on a task indicating that a task +// has changed. +message TaskStatusUpdateEvent { + // The id of the task that is changed + string task_id = 1; + // The id of the context that the task belongs to + string context_id = 2; + // The new status of the task. + TaskStatus status = 3; + // Whether this is the last status update expected for this task. + bool final = 4; + // Optional metadata to associate with the task update. + google.protobuf.Struct metadata = 5; +} + +// TaskArtifactUpdateEvent represents a task delta where an artifact has +// been generated. +message TaskArtifactUpdateEvent { + // The id of the task for this artifact + string task_id = 1; + // The id of the context that this task belongs too + string context_id = 2; + // The artifact itself + Artifact artifact = 3; + // Whether this should be appended to a prior one produced + bool append = 4; + // Whether this represents the last part of an artifact + bool last_chunk = 5; + // Optional metadata associated with the artifact update. + google.protobuf.Struct metadata = 6; +} + +// Configuration for setting up push notifications for task updates. +message PushNotificationConfig { + // A unique id for this push notification. + string id = 1; + // Url to send the notification too + string url = 2; + // Token unique for this task/session + string token = 3; + // Information about the authentication to sent with the notification + AuthenticationInfo authentication = 4; +} + +// Defines authentication details, used for push notifications. +message AuthenticationInfo { + // Supported authentication schemes - e.g. Basic, Bearer, etc + repeated string schemes = 1; + // Optional credentials + string credentials = 2; +} + +// Defines additional transport information for the agent. +message AgentInterface { + // The url this interface is found at. + string url = 1; + // The transport supported this url. This is an open form string, to be + // easily extended for many transport protocols. The core ones officially + // supported are JSONRPC, GRPC and HTTP+JSON. + string transport = 2; +} + +// AgentCard conveys key information: +// - Overall details (version, name, description, uses) +// - Skills; a set of actions/solutions the agent can perform +// - Default modalities/content types supported by the agent. +// - Authentication requirements +// Next ID: 18 +message AgentCard { + // The version of the A2A protocol this agent supports. + string protocol_version = 16; + // A human readable name for the agent. + // Example: "Recipe Agent" + string name = 1; + // A description of the agent's domain of action/solution space. + // Example: "Agent that helps users with recipes and cooking." + string description = 2; + // A URL to the address the agent is hosted at. This represents the + // preferred endpoint as declared by the agent. + string url = 3; + // The transport of the preferred endpoint. If empty, defaults to JSONRPC. + string preferred_transport = 14; + // Announcement of additional supported transports. Client can use any of + // the supported transports. + repeated AgentInterface additional_interfaces = 15; + // The service provider of the agent. + AgentProvider provider = 4; + // The version of the agent. + // Example: "1.0.0" + string version = 5; + // A url to provide additional documentation about the agent. + string documentation_url = 6; + // A2A Capability set supported by the agent. + AgentCapabilities capabilities = 7; + // The security scheme details used for authenticating with this agent. + map security_schemes = 8; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Security requirements for contacting the agent. + // This list can be seen as an OR of ANDs. Each object in the list describes + // one possible set of security requirements that must be present on a + // request. This allows specifying, for example, "callers must either use + // OAuth OR an API Key AND mTLS." + // Example: + // security { + // schemes { key: "oauth" value { list: ["read"] } } + // } + // security { + // schemes { key: "api-key" } + // schemes { key: "mtls" } + // } + repeated Security security = 9; + // protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + // The set of interaction modes that the agent supports across all skills. + // This can be overridden per skill. Defined as mime types. + repeated string default_input_modes = 10; + // The mime types supported as outputs from this agent. + repeated string default_output_modes = 11; + // Skills represent a unit of ability an agent can perform. This may + // somewhat abstract but represents a more focused set of actions that the + // agent is highly likely to succeed at. + repeated AgentSkill skills = 12; + // Whether the agent supports providing an extended agent card when + // the user is authenticated, i.e. is the card from .well-known + // different than the card from GetAgentCard. + bool supports_authenticated_extended_card = 13; + // JSON Web Signatures computed for this AgentCard. + repeated AgentCardSignature signatures = 17; +} + +// Represents information about the service provider of an agent. +message AgentProvider { + // The providers reference url + // Example: "https://ai.google.dev" + string url = 1; + // The providers organization name + // Example: "Google" + string organization = 2; +} + +// Defines the A2A feature set supported by the agent +message AgentCapabilities { + // If the agent will support streaming responses + bool streaming = 1; + // If the agent can send push notifications to the clients webhook + bool push_notifications = 2; + // Extensions supported by this agent. + repeated AgentExtension extensions = 3; +} + +// A declaration of an extension supported by an Agent. +message AgentExtension { + // The URI of the extension. + // Example: "https://developers.google.com/identity/protocols/oauth2" + string uri = 1; + // A description of how this agent uses this extension. + // Example: "Google OAuth 2.0 authentication" + string description = 2; + // Whether the client must follow specific requirements of the extension. + // Example: false + bool required = 3; + // Optional configuration for the extension. + google.protobuf.Struct params = 4; +} + +// AgentSkill represents a unit of action/solution that the agent can perform. +// One can think of this as a type of highly reliable solution that an agent +// can be tasked to provide. Agents have the autonomy to choose how and when +// to use specific skills, but clients should have confidence that if the +// skill is defined that unit of action can be reliably performed. +message AgentSkill { + // Unique id of the skill within this agent. + string id = 1; + // A human readable name for the skill. + string name = 2; + // A human (or llm) readable description of the skill + // details and behaviors. + string description = 3; + // A set of tags for the skill to enhance categorization/utilization. + // Example: ["cooking", "customer support", "billing"] + repeated string tags = 4; + // A set of example queries that this skill is designed to address. + // These examples should help the caller to understand how to craft requests + // to the agent to achieve specific goals. + // Example: ["I need a recipe for bread"] + repeated string examples = 5; + // Possible input modalities supported. + repeated string input_modes = 6; + // Possible output modalities produced + repeated string output_modes = 7; + // protolint:disable REPEATED_FIELD_NAMES_PLURALIZED + // Security schemes necessary for the agent to leverage this skill. + // As in the overall AgentCard.security, this list represents a logical OR of + // security requirement objects. Each object is a set of security schemes + // that must be used together (a logical AND). + repeated Security security = 8; +} + +// AgentCardSignature represents a JWS signature of an AgentCard. +// This follows the JSON format of an RFC 7515 JSON Web Signature (JWS). +message AgentCardSignature { + // The protected JWS header for the signature. This is always a + // base64url-encoded JSON object. Required. + string protected = 1 [(google.api.field_behavior) = REQUIRED]; + // The computed signature, base64url-encoded. Required. + string signature = 2 [(google.api.field_behavior) = REQUIRED]; + // The unprotected JWS header values. + google.protobuf.Struct header = 3; +} + +message TaskPushNotificationConfig { + // name=tasks/{id}/pushNotificationConfigs/{id} + string name = 1; + PushNotificationConfig push_notification_config = 2; +} + +// protolint:disable REPEATED_FIELD_NAMES_PLURALIZED +message StringList { + repeated string list = 1; +} +// protolint:enable REPEATED_FIELD_NAMES_PLURALIZED + +message Security { + map schemes = 1; +} + +message SecurityScheme { + oneof scheme { + APIKeySecurityScheme api_key_security_scheme = 1; + HTTPAuthSecurityScheme http_auth_security_scheme = 2; + OAuth2SecurityScheme oauth2_security_scheme = 3; + OpenIdConnectSecurityScheme open_id_connect_security_scheme = 4; + MutualTlsSecurityScheme mtls_security_scheme = 5; + } +} + +message APIKeySecurityScheme { + // Description of this security scheme. + string description = 1; + // Location of the API key, valid values are "query", "header", or "cookie" + string location = 2; + // Name of the header, query or cookie parameter to be used. + string name = 3; +} + +message HTTPAuthSecurityScheme { + // Description of this security scheme. + string description = 1; + // The name of the HTTP Authentication scheme to be used in the + // Authorization header as defined in RFC7235. The values used SHOULD be + // registered in the IANA Authentication Scheme registry. + // The value is case-insensitive, as defined in RFC7235. + string scheme = 2; + // A hint to the client to identify how the bearer token is formatted. + // Bearer tokens are usually generated by an authorization server, so + // this information is primarily for documentation purposes. + string bearer_format = 3; +} + +message OAuth2SecurityScheme { + // Description of this security scheme. + string description = 1; + // An object containing configuration information for the flow types supported + OAuthFlows flows = 2; + // URL to the oauth2 authorization server metadata + // [RFC8414](https://datatracker.ietf.org/doc/html/rfc8414). TLS is required. + string oauth2_metadata_url = 3; +} + +message OpenIdConnectSecurityScheme { + // Description of this security scheme. + string description = 1; + // Well-known URL to discover the [[OpenID-Connect-Discovery]] provider + // metadata. + string open_id_connect_url = 2; +} + +message MutualTlsSecurityScheme { + // Description of this security scheme. + string description = 1; +} + +message OAuthFlows { + oneof flow { + AuthorizationCodeOAuthFlow authorization_code = 1; + ClientCredentialsOAuthFlow client_credentials = 2; + ImplicitOAuthFlow implicit = 3; + PasswordOAuthFlow password = 4; + } +} + +message AuthorizationCodeOAuthFlow { + // The authorization URL to be used for this flow. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS + string authorization_url = 1; + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 2; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 3; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 4; +} + +message ClientCredentialsOAuthFlow { + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +message ImplicitOAuthFlow { + // The authorization URL to be used for this flow. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS + string authorization_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +message PasswordOAuthFlow { + // The token URL to be used for this flow. This MUST be in the form of a URL. + // The OAuth2 standard requires the use of TLS. + string token_url = 1; + // The URL to be used for obtaining refresh tokens. This MUST be in the + // form of a URL. The OAuth2 standard requires the use of TLS. + string refresh_url = 2; + // The available scopes for the OAuth2 security scheme. A map between the + // scope name and a short description for it. The map MAY be empty. + map scopes = 3; +} + +///////////// Request Messages /////////// +message SendMessageRequest { + Message request = 1 + [(google.api.field_behavior) = REQUIRED, json_name = "message"]; + SendMessageConfiguration configuration = 2; + google.protobuf.Struct metadata = 3; +} + +message GetTaskRequest { + // name=tasks/{id} + string name = 1 [(google.api.field_behavior) = REQUIRED]; + int32 history_length = 2; +} + +message CancelTaskRequest { + // name=tasks/{id} + string name = 1; +} + +message GetTaskPushNotificationConfigRequest { + // name=tasks/{id}/pushNotificationConfigs/{push_id} + string name = 1; +} + +message DeleteTaskPushNotificationConfigRequest { + // name=tasks/{id}/pushNotificationConfigs/{push_id} + string name = 1; +} + +message CreateTaskPushNotificationConfigRequest { + // The task resource for this config. + // Format: tasks/{id} + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string config_id = 2 [(google.api.field_behavior) = REQUIRED]; + TaskPushNotificationConfig config = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +message TaskSubscriptionRequest { + // name=tasks/{id} + string name = 1; +} + +message ListTaskPushNotificationConfigRequest { + // parent=tasks/{id} + string parent = 1; + // For AIP-158 these fields are present. Usually not used/needed. + // The maximum number of configurations to return. + // If unspecified, all configs will be returned. + int32 page_size = 2; + + // A page token received from a previous + // ListTaskPushNotificationConfigRequest call. + // Provide this to retrieve the subsequent page. + // When paginating, all other parameters provided to + // `ListTaskPushNotificationConfigRequest` must match the call that provided + // the page token. + string page_token = 3; +} + +message GetAgentCardRequest { + // Empty. Added to fix linter violation. +} + +//////// Response Messages /////////// +message SendMessageResponse { + oneof payload { + Task task = 1; + Message msg = 2 [json_name = "message"]; + } +} + +// The stream response for a message. The stream should be one of the following +// sequences: +// If the response is a message, the stream should contain one, and only one, +// message and then close +// If the response is a task lifecycle, the first response should be a Task +// object followed by zero or more TaskStatusUpdateEvents and +// TaskArtifactUpdateEvents. The stream should complete when the Task +// if in an interrupted or terminal state. A stream that ends before these +// conditions are met are +message StreamResponse { + oneof payload { + Task task = 1; + Message msg = 2 [json_name = "message"]; + TaskStatusUpdateEvent status_update = 3; + TaskArtifactUpdateEvent artifact_update = 4; + } +} + +message ListTaskPushNotificationConfigResponse { + repeated TaskPushNotificationConfig configs = 1; + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} diff --git a/compat-0.3/spec-grpc/src/main/resources/META-INF/beans.xml b/compat-0.3/spec-grpc/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProtoTest.java b/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProtoTest.java new file mode 100644 index 000000000..cf580b729 --- /dev/null +++ b/compat-0.3/spec-grpc/src/test/java/org/a2aproject/sdk/compat03/grpc/utils/ToProtoTest.java @@ -0,0 +1,292 @@ +package org.a2aproject.sdk.compat03.grpc.utils; + +import static org.a2aproject.sdk.compat03.grpc.Role.ROLE_AGENT; +import static org.a2aproject.sdk.compat03.grpc.Role.ROLE_USER; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.compat03.grpc.SendMessageConfiguration; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendConfiguration; +import org.a2aproject.sdk.compat03.spec.PushNotificationAuthenticationInfo; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.junit.jupiter.api.Test; + +public class ToProtoTest { + + private static final Message SIMPLE_MESSAGE = new Message.Builder() + .role(Message.Role.USER) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .contextId("context-1234") + .messageId("message-1234") + .build(); + + @Test + public void convertAgentCard() { + AgentCard agentCard = new AgentCard.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.2.5") + .build(); + org.a2aproject.sdk.compat03.grpc.AgentCard result = ProtoUtils.ToProto.agentCard(agentCard); + assertEquals("Hello World Agent", result.getName()); + assertEquals("Just a hello world agent", result.getDescription()); + assertEquals("http://localhost:9999", result.getUrl()); + assertEquals("1.0.0", result.getVersion()); + assertEquals("http://example.com/docs", result.getDocumentationUrl()); + assertEquals(1, result.getDefaultInputModesCount()); + assertEquals("text", result.getDefaultInputModes(0)); + assertEquals(1, result.getDefaultOutputModesCount()); + assertEquals("text", result.getDefaultOutputModes(0)); + assertEquals("0.2.5", result.getProtocolVersion()); + agentCard = new AgentCard.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url("http://localhost:9999") + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .preferredTransport("HTTP+JSON") +// .iconUrl("http://example.com/icon.svg") + .securitySchemes(Map.of("basic", new HTTPAuthSecurityScheme.Builder().scheme("basic").description("Basic Auth").build())) + .security(List.of(Map.of("oauth", List.of("read")))) + .protocolVersion("0.2.5") + .build(); + result = ProtoUtils.ToProto.agentCard(agentCard); + assertEquals("Hello World Agent", result.getName()); + assertEquals("Just a hello world agent", result.getDescription()); + assertEquals("http://localhost:9999", result.getUrl()); + assertEquals("1.0.0", result.getVersion()); + assertEquals("http://example.com/docs", result.getDocumentationUrl()); + assertEquals(1, result.getDefaultInputModesCount()); + assertEquals("text", result.getDefaultInputModes(0)); + assertEquals(1, result.getDefaultOutputModesCount()); + assertEquals("text", result.getDefaultOutputModes(0)); + assertEquals("0.2.5", result.getProtocolVersion()); + assertEquals("HTTP+JSON", result.getPreferredTransport()); + assertEquals(1, result.getSecurityCount()); + assertEquals(1, result.getSecurity(0).getSchemesMap().size()); + assertEquals(true, result.getSecurity(0).getSchemesMap().containsKey("oauth")); + assertEquals(1, result.getSecurity(0).getSchemesMap().get("oauth").getListCount()); + assertEquals("read", result.getSecurity(0).getSchemesMap().get("oauth").getList(0)); + assertEquals(1, result.getSecuritySchemesMap().size()); + assertEquals(true, result.getSecuritySchemesMap().containsKey("basic")); + assertEquals(result.getSecuritySchemesMap().get("basic").getApiKeySecurityScheme().getDefaultInstanceForType(), result.getSecuritySchemesMap().get("basic").getApiKeySecurityScheme()); + assertEquals(result.getSecuritySchemesMap().get("basic").getOauth2SecurityScheme().getDefaultInstanceForType(), result.getSecuritySchemesMap().get("basic").getOauth2SecurityScheme()); + assertEquals("basic", result.getSecuritySchemesMap().get("basic").getHttpAuthSecurityScheme().getScheme()); + assertEquals("Basic Auth", result.getSecuritySchemesMap().get("basic").getHttpAuthSecurityScheme().getDescription()); + } + + @Test + public void convertTask() { + Task task = new Task.Builder().id("cancel-task-123") + .contextId("session-xyz") + .status(new TaskStatus(TaskState.SUBMITTED)) + .build(); + org.a2aproject.sdk.compat03.grpc.Task result = ProtoUtils.ToProto.task(task); + assertEquals("session-xyz", result.getContextId()); + assertEquals("cancel-task-123", result.getId()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED, result.getStatus().getState()); + assertEquals(0, result.getArtifactsCount()); + assertEquals(0, result.getHistoryCount()); + task = new Task.Builder().id("cancel-task-123") + .contextId("session-xyz") + .status(new TaskStatus(TaskState.SUBMITTED)) + .artifacts(List.of(new Artifact.Builder() + .artifactId("11") + .name("artefact") + .parts(new TextPart("text")) + .build())) + .history(List.of(SIMPLE_MESSAGE)) + .metadata(Collections.emptyMap()) + .build(); + result = ProtoUtils.ToProto.task(task); + assertEquals("session-xyz", result.getContextId()); + assertEquals("cancel-task-123", result.getId()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_SUBMITTED, result.getStatus().getState()); + assertEquals(1, result.getArtifactsCount()); + assertEquals("11", result.getArtifacts(0).getArtifactId()); + assertEquals("artefact", result.getArtifacts(0).getName()); + assertEquals(1, result.getArtifacts(0).getPartsCount()); + assertEquals(true, result.getArtifacts(0).getParts(0).hasText()); + assertEquals(false, result.getArtifacts(0).getParts(0).hasFile()); + assertEquals(false, result.getArtifacts(0).getParts(0).hasData()); + assertEquals("text", result.getArtifacts(0).getParts(0).getText()); + assertEquals(1, result.getHistoryCount()); + assertEquals("context-1234", result.getHistory(0).getContextId()); + assertEquals("message-1234", result.getHistory(0).getMessageId()); + assertEquals(ROLE_USER, result.getHistory(0).getRole()); + assertEquals(1, result.getHistory(0).getContentCount()); + assertEquals("tell me a joke", result.getHistory(0).getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getHistory(0).getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getHistory(0).getContent(0).getData()); + } + + @Test + public void convertMessage() { + org.a2aproject.sdk.compat03.grpc.Message result = ProtoUtils.ToProto.message(SIMPLE_MESSAGE); + assertEquals("context-1234", result.getContextId()); + assertEquals("message-1234", result.getMessageId()); + assertEquals(ROLE_USER, result.getRole()); + assertEquals(1, result.getContentCount()); + assertEquals("tell me a joke", result.getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getContent(0).getData()); + Message message = new Message.Builder() + .role(Message.Role.AGENT) + .parts(Collections.singletonList(new TextPart("tell me a joke"))) + .messageId("message-1234") + .build(); + result = ProtoUtils.ToProto.message(message); + assertEquals("", result.getContextId()); + assertEquals("message-1234", result.getMessageId()); + assertEquals(ROLE_AGENT, result.getRole()); + assertEquals(1, result.getContentCount()); + assertEquals("tell me a joke", result.getContent(0).getText()); + assertEquals(org.a2aproject.sdk.compat03.grpc.FilePart.getDefaultInstance(), result.getContent(0).getFile()); + assertEquals(org.a2aproject.sdk.compat03.grpc.DataPart.getDefaultInstance(), result.getContent(0).getData()); + } + + @Test + public void convertTaskPushNotificationConfig() { + TaskPushNotificationConfig taskPushConfig = new TaskPushNotificationConfig("push-task-123", + new PushNotificationConfig.Builder() + .url("http://example.com") + .id("xyz") + .build()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig result = ProtoUtils.ToProto.taskPushNotificationConfig(taskPushConfig); + assertEquals("tasks/push-task-123/pushNotificationConfigs/xyz", result.getName()); + assertNotNull(result.getPushNotificationConfig()); + assertEquals("http://example.com", result.getPushNotificationConfig().getUrl()); + assertEquals("xyz", result.getPushNotificationConfig().getId()); + assertEquals(false, result.getPushNotificationConfig().hasAuthentication()); + taskPushConfig + = new TaskPushNotificationConfig("push-task-123", + new PushNotificationConfig.Builder() + .token("AAAAAA") + .authenticationInfo(new PushNotificationAuthenticationInfo(Collections.singletonList("jwt"), "credentials")) + .url("http://example.com") + .id("xyz") + .build()); + result = ProtoUtils.ToProto.taskPushNotificationConfig(taskPushConfig); + assertEquals("tasks/push-task-123/pushNotificationConfigs/xyz", result.getName()); + assertNotNull(result.getPushNotificationConfig()); + assertEquals("http://example.com", result.getPushNotificationConfig().getUrl()); + assertEquals("xyz", result.getPushNotificationConfig().getId()); + assertEquals("AAAAAA", result.getPushNotificationConfig().getToken()); + assertEquals(true, result.getPushNotificationConfig().hasAuthentication()); + assertEquals("credentials", result.getPushNotificationConfig().getAuthentication().getCredentials()); + assertEquals(1, result.getPushNotificationConfig().getAuthentication().getSchemesCount()); + assertEquals("jwt", result.getPushNotificationConfig().getAuthentication().getSchemes(0)); + } + + @Test + public void convertTaskArtifactUpdateEvent() { + TaskArtifactUpdateEvent task = new TaskArtifactUpdateEvent.Builder() + .taskId("task-123") + .contextId("session-123") + .artifact(new Artifact.Builder() + .artifactId("11") + .parts(new TextPart("text")) + .build()).build(); + org.a2aproject.sdk.compat03.grpc.TaskArtifactUpdateEvent result = ProtoUtils.ToProto.taskArtifactUpdateEvent(task); + assertEquals("task-123", result.getTaskId()); + assertEquals("session-123", result.getContextId()); + assertNotNull(result.getArtifact()); + assertEquals("11", result.getArtifact().getArtifactId()); + assertEquals(1, result.getArtifact().getPartsCount()); + assertEquals("text", result.getArtifact().getParts(0).getText()); + } + + @Test + public void convertTaskStatusUpdateEvent() { + TaskStatusUpdateEvent tsue = new TaskStatusUpdateEvent.Builder() + .taskId("1234") + .contextId("xyz") + .status(new TaskStatus(TaskState.COMPLETED)) + .isFinal(true) + .build(); + org.a2aproject.sdk.compat03.grpc.TaskStatusUpdateEvent result = ProtoUtils.ToProto.taskStatusUpdateEvent(tsue); + assertEquals("1234", result.getTaskId()); + assertEquals("xyz", result.getContextId()); + assertEquals(true, result.getFinal()); + assertEquals(org.a2aproject.sdk.compat03.grpc.TaskState.TASK_STATE_COMPLETED, result.getStatus().getState()); + } + + @Test + public void convertSendMessageConfiguration() { + MessageSendConfiguration configuration = new MessageSendConfiguration.Builder() + .acceptedOutputModes(List.of("text")) + .blocking(false) + .build(); + SendMessageConfiguration result = ProtoUtils.ToProto.messageSendConfiguration(configuration); + assertEquals(false, result.getBlocking()); + assertEquals(1, result.getAcceptedOutputModesCount()); + assertEquals("text", result.getAcceptedOutputModesBytes(0).toStringUtf8()); + } + + @Test + public void convertTaskTimestampStatus() { + OffsetDateTime expectedTimestamp = OffsetDateTime.parse("2024-10-05T12:34:56Z"); + TaskStatus testStatus = new TaskStatus(TaskState.COMPLETED, null, expectedTimestamp); + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(testStatus) + .build(); + + org.a2aproject.sdk.compat03.grpc.Task grpcTask = ProtoUtils.ToProto.task(task); + task = ProtoUtils.FromProto.task(grpcTask); + TaskStatus status = task.getStatus(); + assertEquals(TaskState.COMPLETED, status.state()); + assertNotNull(status.timestamp()); + assertEquals(expectedTimestamp, status.timestamp()); + } +} diff --git a/compat-0.3/spec/pom.xml b/compat-0.3/spec/pom.xml new file mode 100644 index 000000000..17ef9f1b5 --- /dev/null +++ b/compat-0.3/spec/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + .. + + a2a-java-sdk-compat-0.3-spec + + jar + + Java SDK A2A Compat 0.3 Spec + Java SDK for the Agent2Agent Protocol (A2A) - Spec + + + + ${project.groupId} + a2a-java-sdk-common + + + com.google.code.gson + gson + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2ACompat03Headers.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2ACompat03Headers.java new file mode 100644 index 000000000..5747fc860 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/common/A2ACompat03Headers.java @@ -0,0 +1,18 @@ +package org.a2aproject.sdk.compat03.common; + +/** + * A2A Protocol v0.3 specific headers. + * These headers differ from the current protocol version. + */ +public final class A2ACompat03Headers { + + /** + * HTTP header name for A2A extensions in protocol v0.3. + * Note: In current versions this is "A2A-Extensions" without the "X-" prefix. + */ + public static final String X_A2A_EXTENSIONS = "X-A2A-Extensions"; + + private A2ACompat03Headers() { + // Utility class + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException.java new file mode 100644 index 000000000..4e0b8e91e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonMappingException.java @@ -0,0 +1,102 @@ +package org.a2aproject.sdk.compat03.json; + +import org.jspecify.annotations.Nullable; + +/** + * Exception for JSON mapping errors when converting between JSON and Java objects. + *

+ * This exception serves as a replacement for Jackson's JsonMappingException, allowing + * the A2A Java SDK to remain independent of any specific JSON library implementation. + * It represents errors that occur during the mapping phase of deserialization or + * serialization, such as type mismatches, invalid values, or constraint violations. + *

+ * This exception extends {@link JsonProcessingException} and is used for more specific + * mapping-related errors compared to general parsing errors. + *

+ * Usage example: + *

{@code
+ * try {
+ *     Task task = JsonUtil.fromJson(json, Task.class);
+ *     if (task.getId() == null) {
+ *         throw new JsonMappingException(null, "Task ID cannot be null");
+ *     }
+ * } catch (JsonProcessingException e) {
+ *     throw new JsonMappingException(null, "Invalid task format: " + e.getMessage(), e);
+ * }
+ * }
+ * + * @see JsonProcessingException for the base exception class + */ +public class JsonMappingException extends JsonProcessingException { + + /** + * Optional reference object that caused the mapping error (e.g., JsonParser or field path). + */ + private final @Nullable Object reference; + + /** + * Constructs a new JsonMappingException with the specified reference and message. + *

+ * The reference parameter can be used to provide context about where the mapping + * error occurred (e.g., a field name, path, or parser reference). It can be null + * if no specific reference is available. + * + * @param reference optional reference object providing context for the error (may be null) + * @param message the detail message explaining the mapping error + */ + public JsonMappingException(@Nullable Object reference, String message) { + super(message); + this.reference = reference; + } + + /** + * Constructs a new JsonMappingException with the specified reference, message, and cause. + *

+ * The reference parameter can be used to provide context about where the mapping + * error occurred (e.g., a field name, path, or parser reference). It can be null + * if no specific reference is available. + * + * @param reference optional reference object providing context for the error (may be null) + * @param message the detail message explaining the mapping error + * @param cause the underlying cause of the mapping error (may be null) + */ + public JsonMappingException(@Nullable Object reference, String message, @Nullable Throwable cause) { + super(message, cause); + this.reference = reference; + } + + /** + * Constructs a new JsonMappingException with the specified message and cause. + *

+ * This constructor is provided for compatibility when no reference object is needed. + * + * @param message the detail message explaining the mapping error + * @param cause the underlying cause of the mapping error (may be null) + */ + public JsonMappingException(String message, @Nullable Throwable cause) { + this(null, message, cause); + } + + /** + * Constructs a new JsonMappingException with the specified message. + *

+ * This constructor is provided for compatibility when no reference object is needed. + * + * @param message the detail message explaining the mapping error + */ + public JsonMappingException(String message) { + this(null, message); + } + + /** + * Returns the reference object that provides context for the mapping error. + *

+ * This may be null if no specific reference was available when the exception + * was created. + * + * @return the reference object, or null if not available + */ + public @Nullable Object getReference() { + return reference; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException.java new file mode 100644 index 000000000..3e064a2d5 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonProcessingException.java @@ -0,0 +1,55 @@ +package org.a2aproject.sdk.compat03.json; + +import org.jspecify.annotations.Nullable; + +/** + * General exception for JSON processing errors during serialization or deserialization. + *

+ * This exception serves as a replacement for Jackson's JsonProcessingException, allowing + * the A2A Java SDK to remain independent of any specific JSON library implementation. + * It can be used with any JSON processing library (Gson, Jackson, etc.). + *

+ * This is the base class for more specific JSON processing exceptions like + * {@link JsonMappingException}. + *

+ * Usage example: + *

{@code
+ * try {
+ *     String json = gson.toJson(object);
+ * } catch (Exception e) {
+ *     throw new JsonProcessingException("Failed to serialize object", e);
+ * }
+ * }
+ * + * @see JsonMappingException for mapping-specific errors + */ +public class JsonProcessingException extends Exception { + + /** + * Constructs a new JsonProcessingException with the specified message. + * + * @param message the detail message explaining the cause of the exception + */ + public JsonProcessingException(String message) { + super(message); + } + + /** + * Constructs a new JsonProcessingException with the specified message and cause. + * + * @param message the detail message explaining the cause of the exception + * @param cause the underlying cause of the exception (may be null) + */ + public JsonProcessingException(String message, @Nullable Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new JsonProcessingException with the specified cause. + * + * @param cause the underlying cause of the exception + */ + public JsonProcessingException(Throwable cause) { + super(cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil.java new file mode 100644 index 000000000..a57493286 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/JsonUtil.java @@ -0,0 +1,902 @@ +package org.a2aproject.sdk.compat03.json; + +import static com.google.gson.stream.JsonToken.BEGIN_ARRAY; +import static com.google.gson.stream.JsonToken.BEGIN_OBJECT; +import static com.google.gson.stream.JsonToken.BOOLEAN; +import static com.google.gson.stream.JsonToken.NULL; +import static com.google.gson.stream.JsonToken.NUMBER; +import static com.google.gson.stream.JsonToken.STRING; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.INTERNAL_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.INVALID_AGENT_RESPONSE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.INVALID_PARAMS_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.INVALID_REQUEST_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.JSON_PARSE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.METHOD_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.TASK_NOT_CANCELABLE_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.TASK_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.UNSUPPORTED_OPERATION_ERROR_CODE; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; +import com.google.gson.ToNumberPolicy; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.DataPart; +import org.a2aproject.sdk.compat03.spec.FileContent; +import org.a2aproject.sdk.compat03.spec.FilePart; +import org.a2aproject.sdk.compat03.spec.FileWithBytes; +import org.a2aproject.sdk.compat03.spec.FileWithUri; +import org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.MutualTLSSecurityScheme; +import org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme; +import org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme; +import org.a2aproject.sdk.compat03.spec.Part; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.SecurityScheme; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import org.jspecify.annotations.Nullable; + +import static org.a2aproject.sdk.compat03.json.JsonUtil.JSONRPCErrorTypeAdapter.THROWABLE_MARKER_FIELD; + +public class JsonUtil { + + private static GsonBuilder createBaseGsonBuilder() { + return new GsonBuilder() + .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) + .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeTypeAdapter()) + .registerTypeHierarchyAdapter(JSONRPCError.class, new JSONRPCErrorTypeAdapter()) + .registerTypeAdapter(TaskState.class, new TaskStateTypeAdapter()) + .registerTypeAdapter(Message.Role.class, new RoleTypeAdapter()) + .registerTypeAdapter(Part.Kind.class, new PartKindTypeAdapter()) + .registerTypeHierarchyAdapter(FileContent.class, new FileContentTypeAdapter()) + .registerTypeHierarchyAdapter(SecurityScheme.class, new SecuritySchemeTypeAdapter()); + } + + /** + * Pre-configured {@link Gson} instance for JSON operations. + *

+ * This mapper is configured with strict parsing mode and all necessary custom TypeAdapters + * for A2A Protocol types including polymorphic types, enums, and date/time types. + *

+ * Used throughout the SDK for consistent JSON serialization and deserialization. + */ + public static final Gson OBJECT_MAPPER = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part.class, new PartTypeAdapter()) + .registerTypeHierarchyAdapter(StreamingEventKind.class, new StreamingEventKindTypeAdapter()) + .registerTypeAdapter(EventKind.class, new EventKindTypeAdapter()) + .create(); + + public static T fromJson(String json, Class classOfT) throws JsonProcessingException { + try { + return OBJECT_MAPPER.fromJson(json, classOfT); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException("Failed to parse JSON", e); + } + } + + public static T fromJson(String json, Type type) throws JsonProcessingException { + try { + return OBJECT_MAPPER.fromJson(json, type); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException("Failed to parse JSON", e); + } + } + + /** + * Serializes an object to a JSON string using Gson. + *

+ * This method uses the pre-configured {@link #OBJECT_MAPPER} to produce + * JSON representation of the provided object. + * + * @param data the object to serialize + * @return JSON string representation of the object + */ + public static String toJson(Object data) throws JsonProcessingException { + try { + return OBJECT_MAPPER.toJson(data); + } catch (JsonSyntaxException e) { + throw new JsonProcessingException("Failed to generate JSON", e); + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link OffsetDateTime} to/from ISO-8601 format. + *

+ * This adapter ensures that OffsetDateTime instances are serialized to ISO-8601 formatted strings + * (e.g., "2023-10-01T12:00:00.234-05:00") and deserialized from the same format. + * This is necessary because Gson cannot access private fields of java.time classes via reflection + * in Java 17+ due to module system restrictions. + *

+ * The adapter uses {@link DateTimeFormatter#ISO_OFFSET_DATE_TIME} for both serialization and + * deserialization, which ensures proper handling of timezone offsets. + * + * @see OffsetDateTime + * @see DateTimeFormatter#ISO_OFFSET_DATE_TIME + */ + static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, OffsetDateTime value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)); + } + } + + @Override + public @Nullable + OffsetDateTime read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String dateTimeString = in.nextString(); + try { + return OffsetDateTime.parse(dateTimeString, DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } catch (DateTimeParseException e) { + throw new JsonSyntaxException("Failed to parse OffsetDateTime: " + dateTimeString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Throwable} and its subclasses. + *

+ * This adapter avoids reflection into {@link Throwable}'s private fields, which is not allowed + * in Java 17+ due to module system restrictions. Instead, it serializes Throwables as simple + * objects containing only the type (fully qualified class name) and message. + *

+ * Serialization: Converts a Throwable to a JSON object with: + *

    + *
  • "type": The fully qualified class name (e.g., "java.lang.IllegalArgumentException")
  • + *
  • "message": The exception message
  • + *
+ *

+ * Deserialization: Reads the JSON and reconstructs the Throwable using reflection to find + * a constructor that accepts a String message parameter. If no such constructor exists or if + * instantiation fails, returns a generic {@link RuntimeException} with the message. + * + * @see Throwable + */ + static class ThrowableTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Throwable value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + out.beginObject(); + out.name("type").value(value.getClass().getName()); + out.name("message").value(value.getMessage()); + out.name(THROWABLE_MARKER_FIELD).value(true); + out.endObject(); + } + + @Override + public @Nullable + Throwable read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + String type = null; + String message = null; + + in.beginObject(); + while (in.hasNext()) { + String fieldName = in.nextName(); + switch (fieldName) { + case "type" -> + type = in.nextString(); + case "message" -> + message = in.nextString(); + default -> + in.skipValue(); + } + } + in.endObject(); + + // Try to reconstruct the Throwable + if (type != null) { + try { + Class throwableClass = Class.forName(type); + if (Throwable.class.isAssignableFrom(throwableClass)) { + // Try to find a constructor that takes a String message + try { + var constructor = throwableClass.getConstructor(String.class); + return (Throwable) constructor.newInstance(message); + } catch (NoSuchMethodException e) { + // No String constructor, return a generic RuntimeException + return new RuntimeException(message); + } + } + } catch (Exception e) { + // If we can't reconstruct the exact type, return a generic RuntimeException + return new RuntimeException(message); + } + } + return new RuntimeException(message); + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link JSONRPCError} and its subclasses. + *

+ * This adapter handles polymorphic deserialization based on the error code, creating the + * appropriate subclass instance. + *

+ * The adapter maps error codes to their corresponding error classes: + *

    + *
  • -32700: {@link JSONParseError}
  • + *
  • -32600: {@link InvalidRequestError}
  • + *
  • -32601: {@link MethodNotFoundError}
  • + *
  • -32602: {@link InvalidParamsError}
  • + *
  • -32603: {@link InternalError}
  • + *
  • -32001: {@link TaskNotFoundError}
  • + *
  • -32002: {@link TaskNotCancelableError}
  • + *
  • -32003: {@link PushNotificationNotSupportedError}
  • + *
  • -32004: {@link UnsupportedOperationError}
  • + *
  • -32005: {@link ContentTypeNotSupportedError}
  • + *
  • -32006: {@link InvalidAgentResponseError}
  • + *
  • Other codes: {@link JSONRPCError}
  • + *
+ * + * @see JSONRPCError + */ + static class JSONRPCErrorTypeAdapter extends TypeAdapter { + + private static final ThrowableTypeAdapter THROWABLE_ADAPTER = new ThrowableTypeAdapter(); + static final String THROWABLE_MARKER_FIELD = "__throwable"; + private static final String CODE_FIELD = "code"; + private static final String DATA_FIELD = "data"; + private static final String MESSAGE_FIELD = "message"; + private static final String TYPE_FIELD = "type"; + + @Override + public void write(JsonWriter out, JSONRPCError value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + out.beginObject(); + out.name(CODE_FIELD).value(value.getCode()); + out.name(MESSAGE_FIELD).value(value.getMessage()); + if (value.getData() != null) { + out.name(DATA_FIELD); + // If data is a Throwable, use ThrowableTypeAdapter to avoid reflection issues + if (value.getData() instanceof Throwable throwable) { + THROWABLE_ADAPTER.write(out, throwable); + } else { + // Use Gson to serialize the data field for non-Throwable types + OBJECT_MAPPER.toJson(value.getData(), Object.class, out); + } + } + out.endObject(); + } + + @Override + public @Nullable + JSONRPCError read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + Integer code = null; + String message = null; + Object data = null; + + in.beginObject(); + while (in.hasNext()) { + String fieldName = in.nextName(); + switch (fieldName) { + case CODE_FIELD -> + code = in.nextInt(); + case MESSAGE_FIELD -> + message = in.nextString(); + case DATA_FIELD -> { + // Read data as a generic object (could be string, number, object, etc.) + data = readDataValue(in); + } + default -> + in.skipValue(); + } + } + in.endObject(); + + // Create the appropriate subclass based on the error code + return createErrorInstance(code, message, data); + } + + /** + * Reads the data field value, which can be of any JSON type. + */ + private @Nullable + Object readDataValue(JsonReader in) throws java.io.IOException { + return switch (in.peek()) { + case STRING -> + in.nextString(); + case NUMBER -> + in.nextDouble(); + case BOOLEAN -> + in.nextBoolean(); + case NULL -> { + in.nextNull(); + yield null; + } + case BEGIN_OBJECT -> { + // Parse as JsonElement to check if it's a Throwable + com.google.gson.JsonElement element = com.google.gson.JsonParser.parseReader(in); + if (element.isJsonObject()) { + com.google.gson.JsonObject obj = element.getAsJsonObject(); + // Check if it has the structure of a serialized Throwable (type + message) + if (obj.has(TYPE_FIELD) && obj.has(MESSAGE_FIELD) && obj.has(THROWABLE_MARKER_FIELD)) { + // Deserialize as Throwable using ThrowableTypeAdapter + yield THROWABLE_ADAPTER.read(new JsonReader(new StringReader(element.toString()))); + } + } + // Otherwise, deserialize as generic object + yield OBJECT_MAPPER.fromJson(element, Object.class); + } + case BEGIN_ARRAY -> + // For arrays, read as raw JSON using Gson + OBJECT_MAPPER.fromJson(in, Object.class); + default -> { + in.skipValue(); + yield null; + } + }; + } + + /** + * Creates the appropriate JSONRPCError subclass based on the error code. + */ + private JSONRPCError createErrorInstance(@Nullable Integer code, @Nullable String message, @Nullable Object data) { + if (code == null) { + throw new JsonSyntaxException("JSONRPCError must have a code field"); + } + + return switch (code) { + case JSON_PARSE_ERROR_CODE -> + new JSONParseError(code, message, data); + case INVALID_REQUEST_ERROR_CODE -> + new InvalidRequestError(code, message, data); + case METHOD_NOT_FOUND_ERROR_CODE -> + new MethodNotFoundError(code, message, data); + case INVALID_PARAMS_ERROR_CODE -> + new InvalidParamsError(code, message, data); + case INTERNAL_ERROR_CODE -> + new org.a2aproject.sdk.compat03.spec.InternalError(code, message, data); + case TASK_NOT_FOUND_ERROR_CODE -> + new TaskNotFoundError(code, message, data); + case TASK_NOT_CANCELABLE_ERROR_CODE -> + new TaskNotCancelableError(code, message, data); + case PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE -> + new PushNotificationNotSupportedError(code, message, data); + case UNSUPPORTED_OPERATION_ERROR_CODE -> + new UnsupportedOperationError(code, message, data); + case CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE -> + new ContentTypeNotSupportedError(code, message, data); + case INVALID_AGENT_RESPONSE_ERROR_CODE -> + new InvalidAgentResponseError(code, message, data); + default -> + new JSONRPCError(code, message, data); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link TaskState} enum. + *

+ * This adapter ensures that TaskState enum values are serialized using their + * wire format string representation (e.g., "completed", "working") rather than + * the Java enum constant name (e.g., "COMPLETED", "WORKING"). + *

+ * For serialization, it uses {@link TaskState#asString()} to get the wire format. + * For deserialization, it uses {@link TaskState#fromString(String)} to parse the + * wire format back to the enum constant. + * + * @see TaskState + * @see TaskState#asString() + * @see TaskState#fromString(String) + */ + static class TaskStateTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, TaskState value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public @Nullable + TaskState read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String stateString = in.nextString(); + try { + return TaskState.fromString(stateString); + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid TaskState: " + stateString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Message.Role} enum. + *

+ * This adapter ensures that Message.Role enum values are serialized using their + * wire format string representation (e.g., "user", "agent") rather than the Java + * enum constant name (e.g., "USER", "AGENT"). + *

+ * For serialization, it uses {@link Message.Role#asString()} to get the wire format. + * For deserialization, it parses the string to the enum constant. + * + * @see Message.Role + * @see Message.Role#asString() + */ + static class RoleTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Message.Role value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public Message.@Nullable Role read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String roleString = in.nextString(); + try { + return switch (roleString) { + case "user" -> + Message.Role.USER; + case "agent" -> + Message.Role.AGENT; + default -> + throw new IllegalArgumentException("Invalid Role: " + roleString); + }; + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid Message.Role: " + roleString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Part.Kind} enum. + *

+ * This adapter ensures that Part.Kind enum values are serialized using their + * wire format string representation (e.g., "text", "file", "data") rather than + * the Java enum constant name (e.g., "TEXT", "FILE", "DATA"). + *

+ * For serialization, it uses {@link Part.Kind#asString()} to get the wire format. + * For deserialization, it parses the string to the enum constant. + * + * @see Part.Kind + * @see Part.Kind#asString() + */ + static class PartKindTypeAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, Part.Kind value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(value.asString()); + } + } + + @Override + public Part.@Nullable Kind read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + String kindString = in.nextString(); + try { + return switch (kindString) { + case "text" -> + Part.Kind.TEXT; + case "file" -> + Part.Kind.FILE; + case "data" -> + Part.Kind.DATA; + default -> + throw new IllegalArgumentException("Invalid Part.Kind: " + kindString); + }; + } catch (IllegalArgumentException e) { + throw new JsonSyntaxException("Invalid Part.Kind: " + kindString, e); + } + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link Part} and its subclasses. + *

+ * This adapter handles polymorphic deserialization based on the "kind" field, creating the + * appropriate subclass instance (TextPart, FilePart, or DataPart). + *

+ * The adapter uses a two-pass approach: first reads the JSON as a tree to inspect the "kind" + * field, then deserializes to the appropriate concrete type. + * + * @see Part + * @see TextPart + * @see FilePart + * @see DataPart + */ + static class PartTypeAdapter extends TypeAdapter> { + + // Create separate Gson instance without the Part adapter to avoid recursion + private final Gson delegateGson = createBaseGsonBuilder().create(); + + @Override + public void write(JsonWriter out, Part value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof TextPart textPart) { + delegateGson.toJson(textPart, TextPart.class, out); + } else if (value instanceof FilePart filePart) { + delegateGson.toJson(filePart, FilePart.class, out); + } else if (value instanceof DataPart dataPart) { + delegateGson.toJson(dataPart, DataPart.class, out); + } else { + throw new JsonSyntaxException("Unknown Part subclass: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + Part read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree so we can inspect the "kind" field + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("Part must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("Part must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + // Use the delegate Gson to deserialize to the concrete type + return switch (kind) { + case "text" -> + delegateGson.fromJson(jsonElement, TextPart.class); + case "file" -> + delegateGson.fromJson(jsonElement, FilePart.class); + case "data" -> + delegateGson.fromJson(jsonElement, DataPart.class); + default -> + throw new JsonSyntaxException("Unknown Part kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link EventKind} and its implementations. + *

+ * Discriminates based on the {@code "kind"} field: + *

    + *
  • {@code "task"} → {@link Task}
  • + *
  • {@code "message"} → {@link Message}
  • + *
+ */ + static class EventKindTypeAdapter extends TypeAdapter { + + private final Gson delegateGson = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part.class, new PartTypeAdapter()) + .create(); + + @Override + public void write(JsonWriter out, EventKind value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + if (value instanceof Task task) { + delegateGson.toJson(task, Task.class, out); + } else if (value instanceof Message message) { + delegateGson.toJson(message, Message.class, out); + } else { + throw new JsonSyntaxException("Unknown EventKind implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable EventKind read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("EventKind must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("EventKind must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + return switch (kind) { + case Task.TASK -> delegateGson.fromJson(jsonElement, Task.class); + case Message.MESSAGE -> delegateGson.fromJson(jsonElement, Message.class); + default -> throw new JsonSyntaxException("Unknown EventKind kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link StreamingEventKind} and its implementations. + *

+ * This adapter handles polymorphic deserialization based on the "kind" field, creating the + * appropriate implementation instance (Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent). + *

+ * The adapter uses a two-pass approach: first reads the JSON as a tree to inspect the "kind" + * field, then deserializes to the appropriate concrete type. + * + * @see StreamingEventKind + * @see Task + * @see Message + * @see TaskStatusUpdateEvent + * @see TaskArtifactUpdateEvent + */ + static class StreamingEventKindTypeAdapter extends TypeAdapter { + + // Create separate Gson instance without the StreamingEventKind adapter to avoid recursion + private final Gson delegateGson = createBaseGsonBuilder() + .registerTypeHierarchyAdapter(Part.class, new PartTypeAdapter()) + .create(); + + @Override + public void write(JsonWriter out, StreamingEventKind value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof Task task) { + delegateGson.toJson(task, Task.class, out); + } else if (value instanceof Message message) { + delegateGson.toJson(message, Message.class, out); + } else if (value instanceof TaskStatusUpdateEvent event) { + delegateGson.toJson(event, TaskStatusUpdateEvent.class, out); + } else if (value instanceof TaskArtifactUpdateEvent event) { + delegateGson.toJson(event, TaskArtifactUpdateEvent.class, out); + } else { + throw new JsonSyntaxException("Unknown StreamingEventKind implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + StreamingEventKind read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree so we can inspect the "kind" field + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("StreamingEventKind must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement kindElement = jsonObject.get("kind"); + if (kindElement == null || !kindElement.isJsonPrimitive()) { + throw new JsonSyntaxException("StreamingEventKind must have a 'kind' field"); + } + + String kind = kindElement.getAsString(); + // Use the delegate Gson to deserialize to the concrete type + return switch (kind) { + case "task" -> + delegateGson.fromJson(jsonElement, Task.class); + case "message" -> + delegateGson.fromJson(jsonElement, Message.class); + case "status-update" -> + delegateGson.fromJson(jsonElement, TaskStatusUpdateEvent.class); + case "artifact-update" -> + delegateGson.fromJson(jsonElement, TaskArtifactUpdateEvent.class); + default -> + throw new JsonSyntaxException("Unknown StreamingEventKind kind: " + kind); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link SecurityScheme} and its implementations. + *

+ * Discriminates based on the {@code "type"} field: + *

    + *
  • {@code "apiKey"} → {@link APIKeySecurityScheme}
  • + *
  • {@code "http"} → {@link HTTPAuthSecurityScheme}
  • + *
  • {@code "oauth2"} → {@link OAuth2SecurityScheme}
  • + *
  • {@code "openIdConnect"} → {@link OpenIdConnectSecurityScheme}
  • + *
  • {@code "mutualTLS"} → {@link MutualTLSSecurityScheme}
  • + *
+ */ + static class SecuritySchemeTypeAdapter extends TypeAdapter { + + // Use a plain Gson to avoid circular initialization — SecurityScheme concrete types + // contain only simple fields (Strings, OAuthFlows) that need no custom adapters. + private final Gson delegateGson = new Gson(); + + @Override + public void write(JsonWriter out, SecurityScheme value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + if (value instanceof APIKeySecurityScheme v) { + delegateGson.toJson(v, APIKeySecurityScheme.class, out); + } else if (value instanceof HTTPAuthSecurityScheme v) { + delegateGson.toJson(v, HTTPAuthSecurityScheme.class, out); + } else if (value instanceof OAuth2SecurityScheme v) { + delegateGson.toJson(v, OAuth2SecurityScheme.class, out); + } else if (value instanceof OpenIdConnectSecurityScheme v) { + delegateGson.toJson(v, OpenIdConnectSecurityScheme.class, out); + } else if (value instanceof MutualTLSSecurityScheme v) { + delegateGson.toJson(v, MutualTLSSecurityScheme.class, out); + } else { + throw new JsonSyntaxException("Unknown SecurityScheme implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable SecurityScheme read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("SecurityScheme must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + com.google.gson.JsonElement typeElement = jsonObject.get("type"); + if (typeElement == null || !typeElement.isJsonPrimitive()) { + throw new JsonSyntaxException("SecurityScheme must have a 'type' field"); + } + + String type = typeElement.getAsString(); + return switch (type) { + case APIKeySecurityScheme.API_KEY -> + delegateGson.fromJson(jsonElement, APIKeySecurityScheme.class); + case HTTPAuthSecurityScheme.HTTP -> + delegateGson.fromJson(jsonElement, HTTPAuthSecurityScheme.class); + case OAuth2SecurityScheme.OAUTH2 -> + delegateGson.fromJson(jsonElement, OAuth2SecurityScheme.class); + case OpenIdConnectSecurityScheme.OPENID_CONNECT -> + delegateGson.fromJson(jsonElement, OpenIdConnectSecurityScheme.class); + case MutualTLSSecurityScheme.MUTUAL_TLS -> + delegateGson.fromJson(jsonElement, MutualTLSSecurityScheme.class); + default -> + throw new JsonSyntaxException("Unknown SecurityScheme type: " + type); + }; + } + } + + /** + * Gson TypeAdapter for serializing and deserializing {@link FileContent} and its implementations. + *

+ * This adapter handles polymorphic deserialization for the sealed FileContent interface, + * which permits two implementations: + *

    + *
  • {@link FileWithBytes} - File content embedded as base64-encoded bytes
  • + *
  • {@link FileWithUri} - File content referenced by URI
  • + *
+ *

+ * The adapter distinguishes between the two types by checking for the presence of + * "bytes" or "uri" fields in the JSON object. + * + * @see FileContent + * @see FileWithBytes + * @see FileWithUri + */ + static class FileContentTypeAdapter extends TypeAdapter { + + // Create separate Gson instance without the FileContent adapter to avoid recursion + private final Gson delegateGson = new Gson(); + + @Override + public void write(JsonWriter out, FileContent value) throws java.io.IOException { + if (value == null) { + out.nullValue(); + return; + } + // Delegate to Gson's default serialization for the concrete type + if (value instanceof FileWithBytes fileWithBytes) { + delegateGson.toJson(fileWithBytes, FileWithBytes.class, out); + } else if (value instanceof FileWithUri fileWithUri) { + delegateGson.toJson(fileWithUri, FileWithUri.class, out); + } else { + throw new JsonSyntaxException("Unknown FileContent implementation: " + value.getClass().getName()); + } + } + + @Override + public @Nullable + FileContent read(JsonReader in) throws java.io.IOException { + if (in.peek() == com.google.gson.stream.JsonToken.NULL) { + in.nextNull(); + return null; + } + + // Read the JSON as a tree to inspect the fields + com.google.gson.JsonElement jsonElement = com.google.gson.JsonParser.parseReader(in); + if (!jsonElement.isJsonObject()) { + throw new JsonSyntaxException("FileContent must be a JSON object"); + } + + com.google.gson.JsonObject jsonObject = jsonElement.getAsJsonObject(); + + // Distinguish between FileWithBytes and FileWithUri by checking for "bytes" or "uri" field + if (jsonObject.has("bytes")) { + return delegateGson.fromJson(jsonElement, FileWithBytes.class); + } else if (jsonObject.has("uri")) { + return delegateGson.fromJson(jsonElement, FileWithUri.class); + } else { + throw new JsonSyntaxException("FileContent must have either 'bytes' or 'uri' field"); + } + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java new file mode 100644 index 000000000..b1b9a5b5c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/json/package-info.java @@ -0,0 +1,8 @@ +/** + * JSON processing exceptions for the A2A Java SDK. + *

+ * This package provides custom exceptions that replace Jackson's JSON processing exceptions, + * allowing the SDK to be independent of any specific JSON library implementation. + */ +@org.jspecify.annotations.NullMarked +package org.a2aproject.sdk.compat03.json; diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError.java new file mode 100644 index 000000000..23f03db35 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientError.java @@ -0,0 +1,17 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Base exception for A2A Client errors. + */ +public class A2AClientError extends RuntimeException { + public A2AClientError() { + } + + public A2AClientError(String message) { + super(message); + } + + public A2AClientError(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException.java new file mode 100644 index 000000000..b93e02ed6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientException.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to an A2A client. + */ +public class A2AClientException extends A2AException { + + public A2AClientException() { + super(); + } + + public A2AClientException(final String msg) { + super(msg); + } + + public A2AClientException(final Throwable cause) { + super(cause); + } + + public A2AClientException(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError.java new file mode 100644 index 000000000..a6066c170 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientHTTPError.java @@ -0,0 +1,34 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +public class A2AClientHTTPError extends A2AClientError { + private final int code; + private final String message; + + public A2AClientHTTPError(int code, String message, Object data) { + Assert.checkNotNullParam("code", code); + Assert.checkNotNullParam("message", message); + this.code = code; + this.message = message; + } + + /** + * Gets the error code + * + * @return the error code + */ + public int getCode() { + return code; + } + + /** + * Gets the error message + * + * @return the error message + */ + @Override + public String getMessage() { + return message; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError.java new file mode 100644 index 000000000..5d23e3f4f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidArgsError.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +public class A2AClientInvalidArgsError extends A2AClientError { + + public A2AClientInvalidArgsError() { + } + + public A2AClientInvalidArgsError(String message) { + super("Invalid arguments error: " + message); + } + + public A2AClientInvalidArgsError(String message, Throwable cause) { + super("Invalid arguments error: " + message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError.java new file mode 100644 index 000000000..4ade31f70 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientInvalidStateError.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +public class A2AClientInvalidStateError extends A2AClientError { + + public A2AClientInvalidStateError() { + } + + public A2AClientInvalidStateError(String message) { + super("Invalid state error: " + message); + } + + public A2AClientInvalidStateError(String message, Throwable cause) { + super("Invalid state error: " + message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError.java new file mode 100644 index 000000000..672ad827c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AClientJSONError.java @@ -0,0 +1,40 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Client exception indicating a JSON serialization or deserialization error. + *

+ * This exception is thrown when the A2A client SDK encounters errors while + * parsing JSON responses from agents or serializing requests. This typically + * indicates: + *

    + *
  • Malformed JSON in agent responses
  • + *
  • Unexpected JSON structure or field types
  • + *
  • Missing required JSON fields
  • + *
  • JSON encoding/decoding errors
  • + *
+ *

+ * Usage example: + *

{@code
+ * try {
+ *     AgentCard card = objectMapper.readValue(json, AgentCard.class);
+ * } catch (org.a2aproject.sdk.compat03.json.JsonProcessingException e) {
+ *     throw new A2AClientJSONError("Failed to parse agent card", e);
+ * }
+ * }
+ * + * @see A2AClientError for the base client error class + * @see JSONParseError for protocol-level JSON errors + */ +public class A2AClientJSONError extends A2AClientError { + + public A2AClientJSONError() { + } + + public A2AClientJSONError(String message) { + super(message); + } + + public A2AClientJSONError(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError.java new file mode 100644 index 000000000..93deddc98 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AError.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface A2AError extends Event { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes.java new file mode 100644 index 000000000..a501b3c98 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AErrorCodes.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * All the error codes for A2A errors. + */ +public interface A2AErrorCodes { + + int TASK_NOT_FOUND_ERROR_CODE = -32001; + int TASK_NOT_CANCELABLE_ERROR_CODE = -32002; + int PUSH_NOTIFICATION_NOT_SUPPORTED_ERROR_CODE = -32003; + int UNSUPPORTED_OPERATION_ERROR_CODE = -32004; + int CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE = -32005; + int INVALID_AGENT_RESPONSE_ERROR_CODE = -32006; + int AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED_ERROR_CODE = -32007; + + int INVALID_REQUEST_ERROR_CODE = -32600; + int METHOD_NOT_FOUND_ERROR_CODE = -32601; + int INVALID_PARAMS_ERROR_CODE = -32602; + int INTERNAL_ERROR_CODE = -32603; + + int JSON_PARSE_ERROR_CODE = -32700; +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException.java new file mode 100644 index 000000000..2dead46c5 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AException.java @@ -0,0 +1,44 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to the A2A protocol. + */ +public class A2AException extends RuntimeException { + + /** + * Constructs a new {@code A2AException} instance. The message is left blank ({@code null}), and no + * cause is specified. + */ + public A2AException() { + } + + /** + * Constructs a new {@code A2AException} instance with an initial message. No cause is specified. + * + * @param msg the message + */ + public A2AException(final String msg) { + super(msg); + } + + /** + * Constructs a new {@code A2AException} instance with an initial cause. If a non-{@code null} cause + * is specified, its message is used to initialize the message of this {@code A2AException}; otherwise + * the message is left blank ({@code null}). + * + * @param cause the cause + */ + public A2AException(final Throwable cause) { + super(cause); + } + + /** + * Constructs a new {@code A2AException} instance with an initial message and cause. + * + * @param msg the message + * @param cause the cause + */ + public A2AException(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException.java new file mode 100644 index 000000000..e0dc56859 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/A2AServerException.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Exception to indicate a general failure related to an A2A server. + */ +public class A2AServerException extends A2AException { + + public A2AServerException() { + super(); + } + + public A2AServerException(final String msg) { + super(msg); + } + + public A2AServerException(final Throwable cause) { + super(cause); + } + + public A2AServerException(final String msg, final Throwable cause) { + super(msg, cause); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme.java new file mode 100644 index 000000000..40bcac78e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/APIKeySecurityScheme.java @@ -0,0 +1,112 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme.API_KEY; + +/** + * Defines a security scheme using an API key. + */ +public final class APIKeySecurityScheme implements SecurityScheme { + + public static final String API_KEY = "apiKey"; + private final String in; + private final String name; + private final String type; + private final String description; + + /** + * Represents the location of the API key. + */ + public enum Location { + COOKIE("cookie"), + HEADER("header"), + QUERY("query"); + + private final String location; + + Location(String location) { + this.location = location; + } + + public String asString() { + return location; + } + + public static Location fromString(String location) { + switch (location) { + case "cookie" -> { + return COOKIE; + } + case "header" -> { + return HEADER; + } + case "query" -> { + return QUERY; + } + default -> throw new IllegalArgumentException("Invalid API key location: " + location); + } + } + } + + public APIKeySecurityScheme(String in, String name, String description) { + this(in, name, description, API_KEY); + } + + public APIKeySecurityScheme(String in, String name, + String description, String type) { + Assert.checkNotNullParam("in", in); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("type", type); + if (! type.equals(API_KEY)) { + throw new IllegalArgumentException("Invalid type for APIKeySecurityScheme"); + } + this.in = in; + this.name = name; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + + public String getIn() { + return in; + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public static class Builder { + private String in; + private String name; + private String description; + + public Builder in(String in) { + this.in = in; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public APIKeySecurityScheme build() { + return new APIKeySecurityScheme(in, name, description); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities.java new file mode 100644 index 000000000..3b949d2bf --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCapabilities.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +/** + * Defines optional capabilities supported by an agent. + */ +public record AgentCapabilities(boolean streaming, boolean pushNotifications, boolean stateTransitionHistory, + List extensions) { + + public static class Builder { + + private boolean streaming; + private boolean pushNotifications; + private boolean stateTransitionHistory; + private List extensions; + + public Builder streaming(boolean streaming) { + this.streaming = streaming; + return this; + } + + public Builder pushNotifications(boolean pushNotifications) { + this.pushNotifications = pushNotifications; + return this; + } + + public Builder stateTransitionHistory(boolean stateTransitionHistory) { + this.stateTransitionHistory = stateTransitionHistory; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = extensions; + return this; + } + + public AgentCapabilities build() { + return new AgentCapabilities(streaming, pushNotifications, stateTransitionHistory, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard.java new file mode 100644 index 000000000..b25341f2f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCard.java @@ -0,0 +1,199 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * The AgentCard is a self-describing manifest for an agent. It provides essential + * metadata including the agent's identity, capabilities, skills, supported + * communication methods, and security requirements. + */ +public record AgentCard(String name, String description, String url, AgentProvider provider, + String version, String documentationUrl, AgentCapabilities capabilities, + List defaultInputModes, List defaultOutputModes, List skills, + boolean supportsAuthenticatedExtendedCard, Map securitySchemes, + List>> security, String iconUrl, List additionalInterfaces, + String preferredTransport, String protocolVersion, List signatures) { + + private static final String DEFAULT_PROTOCOL_VERSION = "0.3.0"; + private static final TransportProtocol DEFAULT_TRANSPORT = TransportProtocol.JSONRPC; + + public AgentCard { + Assert.checkNotNullParam("capabilities", capabilities); + Assert.checkNotNullParam("defaultInputModes", defaultInputModes); + Assert.checkNotNullParam("defaultOutputModes", defaultOutputModes); + Assert.checkNotNullParam("description", description); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("skills", skills); + Assert.checkNotNullParam("url", url); + Assert.checkNotNullParam("version", version); + if (protocolVersion == null) { + protocolVersion = DEFAULT_PROTOCOL_VERSION; + } + if (preferredTransport == null) { + preferredTransport = DEFAULT_TRANSPORT.asString(); + } + } + + public static class Builder { + private String name; + private String description; + private String url; + private AgentProvider provider; + private String version; + private String documentationUrl; + private AgentCapabilities capabilities; + private List defaultInputModes; + private List defaultOutputModes; + private List skills; + private boolean supportsAuthenticatedExtendedCard = false; + private Map securitySchemes; + private List>> security; + private String iconUrl; + private List additionalInterfaces; + private String preferredTransport; + private String protocolVersion; + private List signatures; + + /** + * Creates a new Builder. + */ + public Builder() { + + } + + /** + * Creates a new Builder as a copy of an existing AgentCard. + * + * @param card the AgentCard to copy + */ + public Builder(AgentCard card) { + this.name = card.name; + this.description = card.description; + this.url = card.url; + this.provider = card.provider; + this.version = card.version; + this.documentationUrl = card.documentationUrl; + this.capabilities = card.capabilities; + this.defaultInputModes = card.defaultInputModes != null ? new ArrayList<>(card.defaultInputModes) : null; + this.defaultOutputModes = card.defaultOutputModes != null ? new ArrayList<>(card.defaultOutputModes) : null; + this.skills = card.skills != null ? new ArrayList<>(card.skills) : null; + this.supportsAuthenticatedExtendedCard = card.supportsAuthenticatedExtendedCard; + this.securitySchemes = card.securitySchemes != null ? Map.copyOf(card.securitySchemes) : null; + this.security = card.security != null ? new ArrayList<>(card.security) : null; + this.iconUrl = card.iconUrl; + this.additionalInterfaces = card.additionalInterfaces != null ? new ArrayList<>(card.additionalInterfaces) : null; + this.preferredTransport = card.preferredTransport; + this.protocolVersion = card.protocolVersion; + this.signatures = card.signatures != null ? new ArrayList<>(card.signatures) : null; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder provider(AgentProvider provider) { + this.provider = provider; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + + public Builder documentationUrl(String documentationUrl) { + this.documentationUrl = documentationUrl; + return this; + } + + public Builder capabilities(AgentCapabilities capabilities) { + this.capabilities = capabilities; + return this; + } + + public Builder defaultInputModes(List defaultInputModes) { + this.defaultInputModes = defaultInputModes; + return this; + } + + public Builder defaultOutputModes(List defaultOutputModes) { + this.defaultOutputModes = defaultOutputModes; + return this; + } + + public Builder skills(List skills) { + this.skills = skills; + return this; + } + + public Builder supportsAuthenticatedExtendedCard(boolean supportsAuthenticatedExtendedCard) { + this.supportsAuthenticatedExtendedCard = supportsAuthenticatedExtendedCard; + return this; + } + + public Builder securitySchemes(Map securitySchemes) { + this.securitySchemes = securitySchemes; + return this; + } + + public Builder security(List>> security) { + this.security = security; + return this; + } + + public Builder iconUrl(String iconUrl) { + this.iconUrl = iconUrl; + return this; + } + + public Builder additionalInterfaces(List additionalInterfaces) { + this.additionalInterfaces = additionalInterfaces; + return this; + } + + public Builder preferredTransport(String preferredTransport) { + this.preferredTransport = preferredTransport; + return this; + } + + public Builder protocolVersion(String protocolVersion) { + this.protocolVersion = protocolVersion; + return this; + } + + public Builder signatures(List signatures) { + this.signatures = signatures; + return this; + } + + public AgentCard build() { + if (preferredTransport == null) { + preferredTransport = DEFAULT_TRANSPORT.asString(); + } + if (additionalInterfaces == null) { + // should include an entry matching the main 'url' and 'preferredTransport' + additionalInterfaces = new ArrayList<>(); + additionalInterfaces.add(new AgentInterface(preferredTransport, url)); + } + return new AgentCard(name, description, url, provider, version, documentationUrl, + capabilities, defaultInputModes, defaultOutputModes, skills, + supportsAuthenticatedExtendedCard, securitySchemes, security, iconUrl, + additionalInterfaces, preferredTransport, protocolVersion, signatures); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature.java new file mode 100644 index 000000000..58289f1b0 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentCardSignature.java @@ -0,0 +1,44 @@ +package org.a2aproject.sdk.compat03.spec; + +import com.google.gson.annotations.SerializedName; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JWS signature of an AgentCard. + * This follows the JSON format of an RFC 7515 JSON Web Signature (JWS). + */ +public record AgentCardSignature(Map header, @SerializedName("protected")String protectedHeader, + String signature) { + + public AgentCardSignature { + Assert.checkNotNullParam("protectedHeader", protectedHeader); + Assert.checkNotNullParam("signature", signature); + } + + public static class Builder { + private Map header; + String protectedHeader; + String signature; + + public Builder header(Map header) { + this.header = header; + return this; + } + + public Builder protectedHeader(String protectedHeader) { + this.protectedHeader = protectedHeader; + return this; + } + + public Builder signature(String signature) { + this.signature = signature; + return this; + } + + public AgentCardSignature build() { + return new AgentCardSignature(header, protectedHeader, signature); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension.java new file mode 100644 index 000000000..73fa2070e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentExtension.java @@ -0,0 +1,47 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * A declaration of a protocol extension supported by an Agent. + */ +public record AgentExtension (String description, Map params, boolean required, String uri) { + + public AgentExtension { + Assert.checkNotNullParam("uri", uri); + } + + public static class Builder { + String description; + Map params; + boolean required; + String uri; + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder params(Map params) { + this.params = params; + return this; + } + + public Builder required(boolean required) { + this.required = required; + return this; + } + + public Builder uri(String uri) { + this.uri = uri; + return this; + } + + public AgentExtension build() { + return new AgentExtension(description, params, required, uri); + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface.java new file mode 100644 index 000000000..be611d242 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentInterface.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Declares a combination of a target URL and a transport protocol for interacting with the agent. + */ + +public record AgentInterface(String transport, String url) { + public AgentInterface { + Assert.checkNotNullParam("transport", transport); + Assert.checkNotNullParam("url", url); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider.java new file mode 100644 index 000000000..de272f312 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentProvider.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents the service provider of an agent. + */ +public record AgentProvider(String organization, String url) { + + public AgentProvider { + Assert.checkNotNullParam("organization", organization); + Assert.checkNotNullParam("url", url); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill.java new file mode 100644 index 000000000..072495061 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AgentSkill.java @@ -0,0 +1,77 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * The set of skills, or distinct capabilities, that the agent can perform. + */ +public record AgentSkill(String id, String name, String description, List tags, + List examples, List inputModes, List outputModes, + List>> security) { + + public AgentSkill { + Assert.checkNotNullParam("description", description); + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("name", name); + Assert.checkNotNullParam("tags", tags); + } + + public static class Builder { + + private String id; + private String name; + private String description; + private List tags; + private List examples; + private List inputModes; + private List outputModes; + private List>> security; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder tags(List tags) { + this.tags = tags; + return this; + } + + public Builder examples(List examples) { + this.examples = examples; + return this; + } + + public Builder inputModes(List inputModes) { + this.inputModes = inputModes; + return this; + } + + public Builder outputModes(List outputModes) { + this.outputModes = outputModes; + return this; + } + + public Builder security(List>> security) { + this.security = security; + return this; + } + + public AgentSkill build() { + return new AgentSkill(id, name, description, tags, examples, inputModes, outputModes, security); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact.java new file mode 100644 index 000000000..8a877a3ff --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Artifact.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a file, data structure, or other resource generated by an agent during a task. + */ +public record Artifact(String artifactId, String name, String description, List> parts, Map metadata, + List extensions) { + + public Artifact { + Assert.checkNotNullParam("artifactId", artifactId); + Assert.checkNotNullParam("parts", parts); + if (parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be empty"); + } + } + + public static class Builder { + private String artifactId; + private String name; + private String description; + private List> parts; + private Map metadata; + private List extensions; + + public Builder(){ + } + + public Builder(Artifact existingArtifact) { + artifactId = existingArtifact.artifactId; + name = existingArtifact.name; + description = existingArtifact.description; + parts = existingArtifact.parts; + metadata = existingArtifact.metadata; + extensions = existingArtifact.extensions; + } + + public Builder artifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder parts(List> parts) { + this.parts = parts; + return this; + } + + public Builder parts(Part... parts) { + this.parts = List.of(parts); + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = (extensions == null) ? null : List.copyOf(extensions); + return this; + } + + public Artifact build() { + return new Artifact(artifactId, name, description, parts, metadata, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError.java new file mode 100644 index 000000000..8e7e7edf6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticatedExtendedCardNotConfiguredError.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + + +/** + * An A2A-specific error indicating that the agent does not have an + * Authenticated Extended Card configured + */ +public class AuthenticatedExtendedCardNotConfiguredError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = -32007; + + public AuthenticatedExtendedCardNotConfiguredError(Integer code, String message, Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Authenticated Extended Card not configured"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo.java new file mode 100644 index 000000000..01e88570e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthenticationInfo.java @@ -0,0 +1,15 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +import org.a2aproject.sdk.util.Assert; + +/** + * The authentication info for an agent. + */ +public record AuthenticationInfo(List schemes, String credentials) { + + public AuthenticationInfo { + Assert.checkNotNullParam("schemes", schemes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow.java new file mode 100644 index 000000000..b38db5d78 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/AuthorizationCodeOAuthFlow.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Authorization Code flow. + */ +public record AuthorizationCodeOAuthFlow(String authorizationUrl, String refreshUrl, Map scopes, + String tokenUrl) { + + public AuthorizationCodeOAuthFlow { + Assert.checkNotNullParam("authorizationUrl", authorizationUrl); + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest.java new file mode 100644 index 000000000..371275a04 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskRequest.java @@ -0,0 +1,70 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; + +/** + * A request that can be used to cancel a task. + */ +public final class CancelTaskRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/cancel"; + + public CancelTaskRequest(String jsonrpc, Object id, String method, TaskIdParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid CancelTaskRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public CancelTaskRequest(Object id, TaskIdParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskIdParams params; + + public CancelTaskRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public CancelTaskRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public CancelTaskRequest.Builder method(String method) { + this.method = method; + return this; + } + + public CancelTaskRequest.Builder params(TaskIdParams params) { + this.params = params; + return this; + } + + public CancelTaskRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new CancelTaskRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse.java new file mode 100644 index 000000000..f795c3ab0 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/CancelTaskResponse.java @@ -0,0 +1,21 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response to a cancel task request. + */ + +public final class CancelTaskResponse extends JSONRPCResponse { + + public CancelTaskResponse(String jsonrpc, Object id, Task result, JSONRPCError error) { + super(jsonrpc, id, result, error, Task.class); + } + + public CancelTaskResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + + public CancelTaskResponse(Object id, Task result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow.java new file mode 100644 index 000000000..c4b794339 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ClientCredentialsOAuthFlow.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Client Credentials flow. + */ +public record ClientCredentialsOAuthFlow(String refreshUrl, Map scopes, String tokenUrl) { + + public ClientCredentialsOAuthFlow { + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError.java new file mode 100644 index 000000000..cd2fafcdc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ContentTypeNotSupportedError.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + + +/** + * An A2A-specific error indicating an incompatibility between the requested + * content types and the agent's capabilities. + */ +public class ContentTypeNotSupportedError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; + + public ContentTypeNotSupportedError(Integer code, String message, Object data) { + super(defaultIfNull(code, CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE), + defaultIfNull(message, "Incompatible content types"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart.java new file mode 100644 index 000000000..1ecc65a9f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DataPart.java @@ -0,0 +1,43 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + + +/** + * Represents a structured data segment (e.g., JSON) within a message or artifact. + */ +public class DataPart extends Part> { + + public static final String DATA = "data"; + private final Map data; + private final Map metadata; + private final Kind kind; + + public DataPart(Map data) { + this(data, null); + } + + public DataPart(Map data, Map metadata) { + Assert.checkNotNullParam("data", data); + this.data = data; + this.metadata = metadata; + this.kind = Kind.DATA; + } + + @Override + public Kind getKind() { + return kind; + } + + public Map getData() { + return data; + } + + @Override + public Map getMetadata() { + return metadata; + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams.java new file mode 100644 index 000000000..c562fd681 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigParams.java @@ -0,0 +1,46 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Parameters for removing pushNotificationConfiguration associated with a Task. + */ +public record DeleteTaskPushNotificationConfigParams(String id, String pushNotificationConfigId, Map metadata) { + + public DeleteTaskPushNotificationConfigParams { + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("pushNotificationConfigId", pushNotificationConfigId); + } + + public DeleteTaskPushNotificationConfigParams(String id, String pushNotificationConfigId) { + this(id, pushNotificationConfigId, null); + } + + public static class Builder { + String id; + String pushNotificationConfigId; + Map metadata; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder pushNotificationConfigId(String pushNotificationConfigId) { + this.pushNotificationConfigId = pushNotificationConfigId; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public DeleteTaskPushNotificationConfigParams build() { + return new DeleteTaskPushNotificationConfigParams(id, pushNotificationConfigId, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..450f4346a --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigRequest.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils; + +/** + * A delete task push notification config request. + */ +public final class DeleteTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/pushNotificationConfig/delete"; + + public DeleteTaskPushNotificationConfigRequest(String jsonrpc, Object id, String method, DeleteTaskPushNotificationConfigParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid DeleteTaskPushNotificationConfigRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public DeleteTaskPushNotificationConfigRequest(String id, DeleteTaskPushNotificationConfigParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private DeleteTaskPushNotificationConfigParams params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(DeleteTaskPushNotificationConfigParams params) { + this.params = params; + return this; + } + + public DeleteTaskPushNotificationConfigRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new DeleteTaskPushNotificationConfigRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..e3056ecb3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/DeleteTaskPushNotificationConfigResponse.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for a delete task push notification config request. + */ +public final class DeleteTaskPushNotificationConfigResponse extends JSONRPCResponse { + + public DeleteTaskPushNotificationConfigResponse(String jsonrpc, Object id, Void result,JSONRPCError error) { + super(jsonrpc, id, result, error, Void.class); + } + + public DeleteTaskPushNotificationConfigResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public DeleteTaskPushNotificationConfigResponse(Object id) { + this(null, id, null, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event.java new file mode 100644 index 000000000..baa2778bd --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Event.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface Event { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind.java new file mode 100644 index 000000000..25af3db38 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/EventKind.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Interface for events that can be returned from non-streaming A2A Protocol operations. + *

+ * EventKind represents events that are suitable for synchronous request-response patterns. + * These events provide complete state information and are typically returned as the final + * result of an operation. + *

+ * EventKind implementations use polymorphic JSON serialization with the "kind" discriminator + * to determine the concrete type during deserialization. + *

+ * Permitted implementations: + *

    + *
  • {@link Task} - Complete task state with status and artifacts
  • + *
  • {@link Message} - Full message with all content parts
  • + *
+ * + * @see StreamingEventKind + * @see Event + */ +public interface EventKind { + + String getKind(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent.java new file mode 100644 index 000000000..dafe6ebdd --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileContent.java @@ -0,0 +1,32 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Sealed interface representing file content in the A2A Protocol. + *

+ * FileContent provides a polymorphic abstraction for file data, allowing files to be + * represented either as embedded binary content or as URI references. This flexibility + * enables different strategies for file transmission based on size, security, and + * accessibility requirements. + *

+ * The sealed interface permits only two implementations: + *

    + *
  • {@link FileWithBytes} - File content embedded as base64-encoded bytes (for small files or inline data)
  • + *
  • {@link FileWithUri} - File content referenced by URI (for large files or external resources)
  • + *
+ *

+ * Both implementations must provide: + *

    + *
  • MIME type - Describes the file format (e.g., "image/png", "application/pdf")
  • + *
  • File name - The original or display name for the file
  • + *
+ * + * @see FilePart + * @see FileWithBytes + * @see FileWithUri + */ +public sealed interface FileContent permits FileWithBytes, FileWithUri { + + String mimeType(); + + String name(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart.java new file mode 100644 index 000000000..954ebec08 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FilePart.java @@ -0,0 +1,45 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.FilePart.FILE; + +/** + * Represents a file segment within a message or artifact. The file content can be + * provided either directly as bytes or as a URI. + */ +public class FilePart extends Part { + + public static final String FILE = "file"; + private final FileContent file; + private final Map metadata; + private final Kind kind; + + public FilePart(FileContent file) { + this(file, null); + } + + public FilePart(FileContent file, Map metadata) { + Assert.checkNotNullParam("file", file); + this.file = file; + this.metadata = metadata; + this.kind = Kind.FILE; + } + + @Override + public Kind getKind() { + return kind; + } + + public FileContent getFile() { + return file; + } + + @Override + public Map getMetadata() { + return metadata; + } + +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes.java new file mode 100644 index 000000000..1f5c3690b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithBytes.java @@ -0,0 +1,7 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a file with its content provided directly as a base64-encoded string. + */ +public record FileWithBytes(String mimeType, String name, String bytes) implements FileContent { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri.java new file mode 100644 index 000000000..8b5fcde6d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/FileWithUri.java @@ -0,0 +1,8 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a file with its content located at a specific URI. + */ +public record FileWithUri(String mimeType, String name, String uri) implements FileContent { +} + diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest.java new file mode 100644 index 000000000..cb318ddb3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardRequest.java @@ -0,0 +1,62 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils; + +/** + * Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method. + */ +public final class GetAuthenticatedExtendedCardRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "agent/getAuthenticatedExtendedCard"; + + public GetAuthenticatedExtendedCardRequest(String jsonrpc, Object id, String method, Void params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetAuthenticatedExtendedCardRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetAuthenticatedExtendedCardRequest(String id) { + this(null, id, METHOD, null); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + + public GetAuthenticatedExtendedCardRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetAuthenticatedExtendedCardRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public GetAuthenticatedExtendedCardRequest.Builder method(String method) { + this.method = method; + return this; + } + + public GetAuthenticatedExtendedCardRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetAuthenticatedExtendedCardRequest(jsonrpc, id, method, null); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse.java new file mode 100644 index 000000000..47974f897 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetAuthenticatedExtendedCardResponse.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for the `agent/getAuthenticatedExtendedCard` method. + */ +public final class GetAuthenticatedExtendedCardResponse extends JSONRPCResponse { + + public GetAuthenticatedExtendedCardResponse(String jsonrpc, Object id, AgentCard result, JSONRPCError error) { + super(jsonrpc, id, result, error, AgentCard.class); + } + + public GetAuthenticatedExtendedCardResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public GetAuthenticatedExtendedCardResponse(Object id, AgentCard result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams.java new file mode 100644 index 000000000..f7e50bd79 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigParams.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; +import org.jspecify.annotations.Nullable; + +/** + * Parameters for fetching a pushNotificationConfiguration associated with a Task. + */ +public record GetTaskPushNotificationConfigParams(String id, @Nullable String pushNotificationConfigId, @Nullable Map metadata) { + + public GetTaskPushNotificationConfigParams { + Assert.checkNotNullParam("id", id); + } + + public GetTaskPushNotificationConfigParams(String id) { + this(id, null, null); + } + + public GetTaskPushNotificationConfigParams(String id, String pushNotificationConfigId) { + this(id, pushNotificationConfigId, null); + } + + public static class Builder { + String id; + String pushNotificationConfigId; + Map metadata; + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder pushNotificationConfigId(String pushNotificationConfigId) { + this.pushNotificationConfigId = pushNotificationConfigId; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public GetTaskPushNotificationConfigParams build() { + return new GetTaskPushNotificationConfigParams(id, pushNotificationConfigId, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..cc92d924f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigRequest.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils; + +import java.util.UUID; + +/** + * A get task push notification request. + */ +public final class GetTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/pushNotificationConfig/get"; + + public GetTaskPushNotificationConfigRequest( String jsonrpc, Object id, String method, GetTaskPushNotificationConfigParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetTaskPushNotificationRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetTaskPushNotificationConfigRequest(String id, GetTaskPushNotificationConfigParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private GetTaskPushNotificationConfigParams params; + + public GetTaskPushNotificationConfigRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetTaskPushNotificationConfigRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public GetTaskPushNotificationConfigRequest.Builder method(String method) { + this.method = method; + return this; + } + + public GetTaskPushNotificationConfigRequest.Builder params(GetTaskPushNotificationConfigParams params) { + this.params = params; + return this; + } + + public GetTaskPushNotificationConfigRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetTaskPushNotificationConfigRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..8e7ef240d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskPushNotificationConfigResponse.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A response for a get task push notification request. + */ +public final class GetTaskPushNotificationConfigResponse extends JSONRPCResponse { + + public GetTaskPushNotificationConfigResponse(String jsonrpc, Object id, TaskPushNotificationConfig result, JSONRPCError error) { + super(jsonrpc, id, result, error, TaskPushNotificationConfig.class); + } + + public GetTaskPushNotificationConfigResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public GetTaskPushNotificationConfigResponse(Object id, TaskPushNotificationConfig result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest.java new file mode 100644 index 000000000..e958c1058 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskRequest.java @@ -0,0 +1,71 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import java.util.UUID; + + +import org.a2aproject.sdk.util.Assert; + +/** + * A get task request. + */ +public final class GetTaskRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/get"; + + public GetTaskRequest(String jsonrpc, Object id, String method, TaskQueryParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid GetTaskRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public GetTaskRequest(Object id, TaskQueryParams params) { + this(null, id, METHOD, params); + } + + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = "tasks/get"; + private TaskQueryParams params; + + public GetTaskRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public GetTaskRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public GetTaskRequest.Builder method(String method) { + this.method = method; + return this; + } + + public GetTaskRequest.Builder params(TaskQueryParams params) { + this.params = params; + return this; + } + + public GetTaskRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new GetTaskRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse.java new file mode 100644 index 000000000..b2b5a8dbc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/GetTaskResponse.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response for a get task request. + */ +public final class GetTaskResponse extends JSONRPCResponse { + + public GetTaskResponse(String jsonrpc, Object id, Task result, JSONRPCError error) { + super(jsonrpc, id, result, error, Task.class); + } + + public GetTaskResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public GetTaskResponse(Object id, Task result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme.java new file mode 100644 index 000000000..72b76788c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/HTTPAuthSecurityScheme.java @@ -0,0 +1,75 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.HTTPAuthSecurityScheme.HTTP; + +/** + * Defines a security scheme using HTTP authentication. + */ +public final class HTTPAuthSecurityScheme implements SecurityScheme { + + public static final String HTTP = "http"; + private final String bearerFormat; + private final String scheme; + private final String description; + private final String type; + + public HTTPAuthSecurityScheme(String bearerFormat, String scheme, String description) { + this(bearerFormat, scheme, description, HTTP); + } + + public HTTPAuthSecurityScheme(String bearerFormat, String scheme, String description, String type) { + Assert.checkNotNullParam("scheme", scheme); + Assert.checkNotNullParam("type", type); + if (! HTTP.equals(type)) { + throw new IllegalArgumentException("Invalid type for HTTPAuthSecurityScheme"); + } + this.bearerFormat = bearerFormat; + this.scheme = scheme; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getBearerFormat() { + return bearerFormat; + } + + public String getScheme() { + return scheme; + } + + public String getType() { + return type; + } + + public static class Builder { + private String bearerFormat; + private String scheme; + private String description; + + public Builder bearerFormat(String bearerFormat) { + this.bearerFormat = bearerFormat; + return this; + } + + public Builder scheme(String scheme) { + this.scheme = scheme; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public HTTPAuthSecurityScheme build() { + return new HTTPAuthSecurityScheme(bearerFormat, scheme, description); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException.java new file mode 100644 index 000000000..94e633820 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IdJsonMappingException.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.compat03.json.JsonMappingException; + +public class IdJsonMappingException extends JsonMappingException { + + Object id; + + public IdJsonMappingException(String msg, Object id) { + super(msg); + this.id = id; + } + + public IdJsonMappingException(String msg, Throwable cause, Object id) { + super(msg, cause); + this.id = id; + } + + public Object getId() { + return id; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow.java new file mode 100644 index 000000000..5bc9b2ce8 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ImplicitOAuthFlow.java @@ -0,0 +1,17 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Implicit flow. + */ +public record ImplicitOAuthFlow(String authorizationUrl, String refreshUrl, Map scopes) { + + public ImplicitOAuthFlow { + Assert.checkNotNullParam("authorizationUrl", authorizationUrl); + Assert.checkNotNullParam("scopes", scopes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId.java new file mode 100644 index 000000000..7bb6606a5 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/IntegerJsonrpcId.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public class IntegerJsonrpcId { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError.java new file mode 100644 index 000000000..87a7c5cf6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InternalError.java @@ -0,0 +1,23 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + + +/** + * An error indicating an internal error on the server. + */ +public class InternalError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.INTERNAL_ERROR_CODE; + + public InternalError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.INTERNAL_ERROR_CODE), + defaultIfNull(message, "Internal Error"), + data); + } + + public InternalError(String message) { + this(null, message, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError.java new file mode 100644 index 000000000..6d5665417 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidAgentResponseError.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + + +/** + * A2A Protocol error indicating that an agent returned a response not conforming to protocol specifications. + *

+ * This error is typically raised by client implementations when validating agent responses. + * It indicates that the agent's response structure, content, or format violates the A2A Protocol + * requirements for the invoked method. + *

+ * Common violations: + *

    + *
  • Missing required fields in response objects
  • + *
  • Invalid field types or values
  • + *
  • Malformed event stream data
  • + *
  • Response doesn't match declared agent capabilities
  • + *
+ *

+ * Corresponds to A2A-specific error code {@code -32006}. + *

+ * Usage example: + *

{@code
+ * SendMessageResponse response = client.sendMessage(request);
+ * if (response.task() == null) {
+ *     throw new InvalidAgentResponseError(
+ *         null,
+ *         "Response missing required 'task' field",
+ *         null
+ *     );
+ * }
+ * }
+ * + * @see JSONRPCResponse for response structure + * @see SendMessageResponse for message send response + * @see A2A Protocol Specification + + */ +public class InvalidAgentResponseError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.INVALID_AGENT_RESPONSE_ERROR_CODE; + + public InvalidAgentResponseError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.INVALID_AGENT_RESPONSE_ERROR_CODE), + defaultIfNull(message, "Invalid agent response"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError.java new file mode 100644 index 000000000..01f1bc23e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsError.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * JSON-RPC error indicating that method parameters are invalid or missing required fields. + *

+ * This error is returned when a JSON-RPC method is called with parameters that fail validation. + * Common causes include: + *

    + *
  • Missing required parameters
  • + *
  • Parameters of incorrect type
  • + *
  • Parameter values outside acceptable ranges
  • + *
  • Malformed parameter structures
  • + *
+ *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32602}. + *

+ * Usage example: + *

{@code
+ * // Default error with standard message
+ * throw new InvalidParamsError();
+ *
+ * // Custom error message
+ * throw new InvalidParamsError("taskId parameter is required");
+ * }
+ * + * @see JSONRPCError for the base error class + * @see A2AError for the error marker interface + * @see JSON-RPC 2.0 Error Codes + */ +public class InvalidParamsError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.INVALID_PARAMS_ERROR_CODE; + + public InvalidParamsError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.INVALID_PARAMS_ERROR_CODE), + defaultIfNull(message, "Invalid parameters"), + data); + } + + public InvalidParamsError(String message) { + this(null, message, null); + } + + public InvalidParamsError() { + this(null, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException.java new file mode 100644 index 000000000..9a1979353 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidParamsJsonMappingException.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.spec; + +public class InvalidParamsJsonMappingException extends IdJsonMappingException { + + public InvalidParamsJsonMappingException(String msg, Object id) { + super(msg, id); + } + + public InvalidParamsJsonMappingException(String msg, Throwable cause, Object id) { + super(msg, cause, id); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError.java new file mode 100644 index 000000000..cdd3a4250 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/InvalidRequestError.java @@ -0,0 +1,51 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + + +/** + * JSON-RPC error indicating that the request payload is not a valid JSON-RPC Request object. + *

+ * This error is returned when the JSON-RPC request fails structural validation. + * Common causes include: + *

    + *
  • Missing required JSON-RPC fields (jsonrpc, method, id)
  • + *
  • Invalid JSON-RPC version (must be "2.0")
  • + *
  • Malformed request structure
  • + *
  • Type mismatches in required fields
  • + *
+ *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32600}. + *

+ * Usage example: + *

{@code
+ * // Default error with standard message
+ * throw new InvalidRequestError();
+ *
+ * // Custom error message
+ * throw new InvalidRequestError("Missing 'method' field in request");
+ * }
+ * + * @see JSONRPCError for the base error class + * @see A2AError for the error marker interface + * @see JSON-RPC 2.0 Error Codes + */ +public class InvalidRequestError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.INVALID_REQUEST_ERROR_CODE; + + public InvalidRequestError() { + this(null, null, null); + } + + public InvalidRequestError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.INVALID_REQUEST_ERROR_CODE), + defaultIfNull(message, "Request payload validation error"), + data); + } + + public InvalidRequestError(String message) { + this(null, message, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse.java new file mode 100644 index 000000000..c24c5fc48 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONErrorResponse.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * A simplified error response wrapper for non-JSON-RPC error scenarios. + *

+ * This record provides a lightweight error response format for cases where + * a full JSON-RPC error structure is not appropriate, such as HTTP-level + * errors or transport-layer failures. + *

+ * Unlike {@link JSONRPCErrorResponse}, this is not part of the JSON-RPC 2.0 + * specification but serves as a utility for simpler error reporting in the + * A2A Java SDK implementation. + * + * @param error a human-readable error message + * @see JSONRPCErrorResponse + * @see JSONRPCError + */ +public record JSONErrorResponse(String error) { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError.java new file mode 100644 index 000000000..8996a8344 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONParseError.java @@ -0,0 +1,50 @@ +package org.a2aproject.sdk.compat03.spec; + + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * JSON-RPC error indicating that the server received invalid JSON that could not be parsed. + *

+ * This error is returned when the request payload is not valid JSON, such as malformed syntax, + * unexpected tokens, or encoding issues. This is distinct from {@link InvalidRequestError}, + * which indicates structurally valid JSON that doesn't conform to the JSON-RPC specification. + *

+ * Corresponds to JSON-RPC 2.0 error code {@code -32700}. + *

+ * Usage example: + *

{@code
+ * try {
+ *     objectMapper.readValue(payload, JSONRPCRequest.class);
+ * } catch (org.a2aproject.sdk.compat03.json.JsonProcessingException e) {
+ *     throw new JSONParseError("Malformed JSON: " + e.getMessage());
+ * }
+ * }
+ * + * @see JSONRPCError for the base error class + * @see A2AError for the error marker interface + * @see InvalidRequestError for structurally valid but invalid requests + * @see JSON-RPC 2.0 Error Codes + */ +public class JSONParseError extends JSONRPCError implements A2AError { + + public final static Integer DEFAULT_CODE = -32700; + + public JSONParseError() { + this(null, null, null); + } + + public JSONParseError(String message) { + this(null, message, null); + } + + public JSONParseError( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Invalid JSON payload"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError.java new file mode 100644 index 000000000..d917017df --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCError.java @@ -0,0 +1,49 @@ +package org.a2aproject.sdk.compat03.spec; + + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSON-RPC 2.0 Error object, included in an error response. + */ +public class JSONRPCError extends Error implements Event, A2AError { + + private final Integer code; + private final Object data; + + /** + * Constructs a JSON-RPC error with the specified code, message, and optional data. + *

+ * This constructor is used by Jackson for JSON deserialization. + * + * @param code the numeric error code (required, see JSON-RPC 2.0 spec for standard codes) + * @param message the human-readable error message (required) + * @param data additional error information, structure defined by the error code (optional) + * @throws IllegalArgumentException if code or message is null + */ + public JSONRPCError(Integer code, String message, Object data) { + super(message); + Assert.checkNotNullParam("code", code); + Assert.checkNotNullParam("message", message); + this.code = code; + this.data = data; + } + + /** + * Gets the error code + * + * @return the error code + */ + public Integer getCode() { + return code; + } + + /** + * Gets the data associated with the error. + * + * @return the data. May be {@code null} + */ + public Object getData() { + return data; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse.java new file mode 100644 index 000000000..039b2b52d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorResponse.java @@ -0,0 +1,33 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * A JSON RPC error response. + */ +public final class JSONRPCErrorResponse extends JSONRPCResponse { + + /** + * Constructs a JSON-RPC error response with all fields. + *

+ * This constructor is used for JSON deserialization. + * + * @param jsonrpc the JSON-RPC version (must be "2.0") + * @param id the request ID, or null if the ID could not be determined from the request + * @param result must be null for error responses + * @param error the error object describing what went wrong (required) + * @throws IllegalArgumentException if error is null + */ + public JSONRPCErrorResponse(String jsonrpc, Object id, Void result, JSONRPCError error) { + super(jsonrpc, id, result, error, Void.class); + Assert.checkNotNullParam("error", error); + } + + public JSONRPCErrorResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public JSONRPCErrorResponse(JSONRPCError error) { + this(null, null, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage.java new file mode 100644 index 000000000..549770270 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCMessage.java @@ -0,0 +1,13 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the base structure for any JSON-RPC 2.0 request, response, or notification. + */ +public sealed interface JSONRPCMessage permits JSONRPCRequest, JSONRPCResponse { + + String JSONRPC_VERSION = "2.0"; + + String getJsonrpc(); + Object getId(); + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest.java new file mode 100644 index 000000000..1fde52137 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCRequest.java @@ -0,0 +1,47 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSONRPC request. + */ +public abstract sealed class JSONRPCRequest implements JSONRPCMessage permits NonStreamingJSONRPCRequest, StreamingJSONRPCRequest { + + protected String jsonrpc; + protected Object id; + protected String method; + protected T params; + + public JSONRPCRequest() { + } + + public JSONRPCRequest(String jsonrpc, Object id, String method, T params) { + Assert.checkNotNullParam("jsonrpc", jsonrpc); + Assert.checkNotNullParam("method", method); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + @Override + public String getJsonrpc() { + return this.jsonrpc; + } + + @Override + public Object getId() { + return this.id; + } + + public String getMethod() { + return this.method; + } + + public T getParams() { + return this.params; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse.java new file mode 100644 index 000000000..7096b9014 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JSONRPCResponse.java @@ -0,0 +1,57 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents a JSONRPC response. + */ +public abstract sealed class JSONRPCResponse implements JSONRPCMessage permits SendStreamingMessageResponse, + GetTaskResponse, CancelTaskResponse, SetTaskPushNotificationConfigResponse, GetTaskPushNotificationConfigResponse, + SendMessageResponse, DeleteTaskPushNotificationConfigResponse, ListTaskPushNotificationConfigResponse, JSONRPCErrorResponse, + GetAuthenticatedExtendedCardResponse { + + protected String jsonrpc; + protected Object id; + protected T result; + protected JSONRPCError error; + + public JSONRPCResponse() { + } + + public JSONRPCResponse(String jsonrpc, Object id, T result, JSONRPCError error, Class resultType) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + if (error != null && result != null) { + throw new IllegalArgumentException("Invalid JSON-RPC error response"); + } + if (error == null && result == null && ! Void.class.equals(resultType)) { + throw new IllegalArgumentException("Invalid JSON-RPC success response"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.result = result; + this.error = error; + } + + @Override + public String getJsonrpc() { + return this.jsonrpc; + } + + @Override + public Object getId() { + return this.id; + } + + public T getResult() { + return this.result; + } + + public JSONRPCError getError() { + return this.error; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId.java new file mode 100644 index 000000000..df51be822 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/JsonrpcId.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public interface JsonrpcId { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams.java new file mode 100644 index 000000000..69fd96a7d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigParams.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Parameters for getting list of pushNotificationConfigurations associated with a Task. + */ +public record ListTaskPushNotificationConfigParams(String id, Map metadata) { + + public ListTaskPushNotificationConfigParams { + Assert.checkNotNullParam("id", id); + } + + public ListTaskPushNotificationConfigParams(String id) { + this(id, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..f19b5e636 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigRequest.java @@ -0,0 +1,67 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; +import org.a2aproject.sdk.compat03.util.Utils; + +/** + * A list task push notification config request. + */ +public final class ListTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/pushNotificationConfig/list"; + + public ListTaskPushNotificationConfigRequest(String jsonrpc, Object id, String method, ListTaskPushNotificationConfigParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid ListTaskPushNotificationConfigRequest method"); + } + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public ListTaskPushNotificationConfigRequest(String id, ListTaskPushNotificationConfigParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private ListTaskPushNotificationConfigParams params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(ListTaskPushNotificationConfigParams params) { + this.params = params; + return this; + } + + public ListTaskPushNotificationConfigRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new ListTaskPushNotificationConfigRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..7a9a3bc97 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/ListTaskPushNotificationConfigResponse.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +/** + * A response for a list task push notification config request. + */ +public final class ListTaskPushNotificationConfigResponse extends JSONRPCResponse> { + + public ListTaskPushNotificationConfigResponse(String jsonrpc, Object id, List result, JSONRPCError error) { + super(jsonrpc, id, result, error, (Class>) (Class) List.class); + } + + public ListTaskPushNotificationConfigResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public ListTaskPushNotificationConfigResponse(Object id, List result) { + this(null, id, result, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message.java new file mode 100644 index 000000000..f4c671cd3 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Message.java @@ -0,0 +1,198 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.Message.MESSAGE; + +/** + * Represents a single message in the conversation between a user and an agent. + */ +public final class Message implements EventKind, StreamingEventKind { + + public static final String MESSAGE = "message"; + private final Role role; + private final List> parts; + private final String messageId; + private String contextId; + private String taskId; + private final Map metadata; + private final String kind; + private final List referenceTaskIds; + private final List extensions; + + public Message(Role role, List> parts, String messageId, String contextId, String taskId, + List referenceTaskIds, Map metadata, List extensions) { + this(role, parts, messageId, contextId, taskId, referenceTaskIds, metadata, extensions, MESSAGE); + } + + public Message(Role role, List> parts, + String messageId, String contextId, + String taskId, List referenceTaskIds, + Map metadata, List extensions, + String kind) { + Assert.checkNotNullParam("kind", kind); + Assert.checkNotNullParam("parts", parts); + if (parts.isEmpty()) { + throw new IllegalArgumentException("Parts cannot be empty"); + } + Assert.checkNotNullParam("role", role); + if (! kind.equals(MESSAGE)) { + throw new IllegalArgumentException("Invalid Message"); + } + Assert.checkNotNullParam("messageId", messageId); + this.role = role; + this.parts = parts; + this.messageId = messageId; + this.contextId = contextId; + this.taskId = taskId; + this.referenceTaskIds = referenceTaskIds; + this.metadata = metadata; + this.extensions = extensions; + this.kind = kind; + } + + public Role getRole() { + return role; + } + + public List> getParts() { + return parts; + } + + public String getMessageId() { + return messageId; + } + + public String getContextId() { + return contextId; + } + + public String getTaskId() { + return taskId; + } + + public Map getMetadata() { + return metadata; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public void setContextId(String contextId) { + this.contextId = contextId; + } + + public List getReferenceTaskIds() { + return referenceTaskIds; + } + + public List getExtensions() { + return extensions; + } + + @Override + public String getKind() { + return kind; + } + + public enum Role { + USER("user"), + AGENT("agent"); + + private final String role; + + Role(String role) { + this.role = role; + } + + /** + * Returns the string representation of the role for JSON serialization. + * + * @return the role as a string ("user" or "agent") + */ + public String asString() { + return this.role; + } + } + + public static class Builder { + + private Role role; + private List> parts; + private String messageId; + private String contextId; + private String taskId; + private List referenceTaskIds; + private Map metadata; + private List extensions; + + public Builder() { + } + + public Builder(Message message) { + role = message.role; + parts = message.parts; + messageId = message.messageId; + contextId = message.contextId; + taskId = message.taskId; + referenceTaskIds = message.referenceTaskIds; + metadata = message.metadata; + extensions = message.extensions; + } + + public Builder role(Role role) { + this.role = role; + return this; + } + + public Builder parts(List> parts) { + this.parts = parts; + return this; + } + + public Builder parts(Part...parts) { + this.parts = List.of(parts); + return this; + } + + public Builder messageId(String messageId) { + this.messageId = messageId; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder taskId(String taskId) { + this.taskId = taskId; + return this; + } + + public Builder referenceTaskIds(List referenceTaskIds) { + this.referenceTaskIds = referenceTaskIds; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder extensions(List extensions) { + this.extensions = (extensions == null) ? null : List.copyOf(extensions); + return this; + } + + public Message build() { + return new Message(role, parts, messageId == null ? UUID.randomUUID().toString() : messageId, + contextId, taskId, referenceTaskIds, metadata, extensions); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration.java new file mode 100644 index 000000000..a661a2ee4 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendConfiguration.java @@ -0,0 +1,54 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; + +/** + * Defines configuration options for a `message/send` or `message/stream` request. + */ +public record MessageSendConfiguration(List acceptedOutputModes, Integer historyLength, + PushNotificationConfig pushNotificationConfig, Boolean blocking) { + + public MessageSendConfiguration { + if (historyLength != null && historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + } + + public static class Builder { + + List acceptedOutputModes; + Integer historyLength; + PushNotificationConfig pushNotificationConfig; + Boolean blocking = true; + + public Builder acceptedOutputModes(List acceptedOutputModes) { + this.acceptedOutputModes = acceptedOutputModes; + return this; + } + + public Builder pushNotificationConfig(@Nullable PushNotificationConfig pushNotificationConfig) { + this.pushNotificationConfig = pushNotificationConfig; + return this; + } + + public Builder historyLength(@Nullable Integer historyLength) { + if (historyLength != null && historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + this.historyLength = historyLength; + return this; + } + + public Builder blocking(@NonNull Boolean blocking) { + this.blocking = blocking; + return this; + } + + public MessageSendConfiguration build() { + return new MessageSendConfiguration(acceptedOutputModes, historyLength, pushNotificationConfig, blocking); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams.java new file mode 100644 index 000000000..8f350f365 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MessageSendParams.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines the parameters for a request to send a message to an agent. This can be used + * to create a new task, continue an existing one, or restart a task. + */ +public record MessageSendParams(Message message, MessageSendConfiguration configuration, + Map metadata) { + + public MessageSendParams { + Assert.checkNotNullParam("message", message); + } + + public static class Builder { + Message message; + MessageSendConfiguration configuration; + Map metadata; + + public Builder message(Message message) { + this.message = message; + return this; + } + + public Builder configuration(MessageSendConfiguration configuration) { + this.configuration = configuration; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public MessageSendParams build() { + return new MessageSendParams(message, configuration, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError.java new file mode 100644 index 000000000..71895fd00 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundError.java @@ -0,0 +1,20 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.spec.A2AErrorCodes.METHOD_NOT_FOUND_ERROR_CODE; +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * An error indicating that the requested method does not exist or is not available. + */ +public class MethodNotFoundError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = METHOD_NOT_FOUND_ERROR_CODE; + + public MethodNotFoundError(Integer code, String message, Object data) { + super(defaultIfNull(code, METHOD_NOT_FOUND_ERROR_CODE), defaultIfNull(message, "Method not found"), data); + } + + public MethodNotFoundError() { + this(METHOD_NOT_FOUND_ERROR_CODE, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException.java new file mode 100644 index 000000000..0dd1dde9b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MethodNotFoundJsonMappingException.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.spec; + +public class MethodNotFoundJsonMappingException extends IdJsonMappingException { + + public MethodNotFoundJsonMappingException(String msg, Object id) { + super(msg, id); + } + + public MethodNotFoundJsonMappingException(String msg, Throwable cause, Object id) { + super(msg, cause, id); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme.java new file mode 100644 index 000000000..0fb604ccc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/MutualTLSSecurityScheme.java @@ -0,0 +1,42 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.MutualTLSSecurityScheme.MUTUAL_TLS; + +/** + * Defines a security scheme using mTLS authentication. + */ +public final class MutualTLSSecurityScheme implements SecurityScheme { + + public static final String MUTUAL_TLS = "mutualTLS"; + private final String description; + private final String type; + + public MutualTLSSecurityScheme(String description) { + this(description, MUTUAL_TLS); + } + + public MutualTLSSecurityScheme() { + this(null, MUTUAL_TLS); + } + + public MutualTLSSecurityScheme(String description, String type) { + Assert.checkNotNullParam("type", type); + if (!type.equals(MUTUAL_TLS)) { + throw new IllegalArgumentException("Invalid type for MutualTLSSecurityScheme"); + } + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getType() { + return type; + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest.java new file mode 100644 index 000000000..b0ae4b9e7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/NonStreamingJSONRPCRequest.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a non-streaming JSON-RPC request. + */ +public abstract sealed class NonStreamingJSONRPCRequest extends JSONRPCRequest permits GetTaskRequest, + CancelTaskRequest, SetTaskPushNotificationConfigRequest, GetTaskPushNotificationConfigRequest, + SendMessageRequest, DeleteTaskPushNotificationConfigRequest, ListTaskPushNotificationConfigRequest, + GetAuthenticatedExtendedCardRequest { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme.java new file mode 100644 index 000000000..506f910bc --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuth2SecurityScheme.java @@ -0,0 +1,75 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.OAuth2SecurityScheme.OAUTH2; + +/** + * Defines a security scheme using OAuth 2.0. + */ +public final class OAuth2SecurityScheme implements SecurityScheme { + + public static final String OAUTH2 = "oauth2"; + private final OAuthFlows flows; + private final String description; + private final String type; + private final String oauth2MetadataUrl; + + public OAuth2SecurityScheme(OAuthFlows flows, String description, String oauth2MetadataUrl) { + this(flows, description, oauth2MetadataUrl, OAUTH2); + } + + public OAuth2SecurityScheme(OAuthFlows flows, String description, String oauth2MetadataUrl, String type) { + Assert.checkNotNullParam("flows", flows); + Assert.checkNotNullParam("type", type); + if (!type.equals(OAUTH2)) { + throw new IllegalArgumentException("Invalid type for OAuth2SecurityScheme"); + } + this.flows = flows; + this.description = description; + this.oauth2MetadataUrl = oauth2MetadataUrl; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public OAuthFlows getFlows() { + return flows; + } + + public String getType() { + return type; + } + + public String getOauth2MetadataUrl() { + return oauth2MetadataUrl; + } + + public static class Builder { + private OAuthFlows flows; + private String description; + private String oauth2MetadataUrl; + + public Builder flows(OAuthFlows flows) { + this.flows = flows; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public Builder oauth2MetadataUrl(String oauth2MetadataUrl) { + this.oauth2MetadataUrl = oauth2MetadataUrl; + return this; + } + + public OAuth2SecurityScheme build() { + return new OAuth2SecurityScheme(flows, description, oauth2MetadataUrl); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows.java new file mode 100644 index 000000000..e8f9ae349 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OAuthFlows.java @@ -0,0 +1,39 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the configuration for the supported OAuth 2.0 flows. + */ +public record OAuthFlows(AuthorizationCodeOAuthFlow authorizationCode, ClientCredentialsOAuthFlow clientCredentials, + ImplicitOAuthFlow implicit, PasswordOAuthFlow password) { + + public static class Builder { + private AuthorizationCodeOAuthFlow authorizationCode; + private ClientCredentialsOAuthFlow clientCredentials; + private ImplicitOAuthFlow implicit; + private PasswordOAuthFlow password; + + public Builder authorizationCode(AuthorizationCodeOAuthFlow authorizationCode) { + this.authorizationCode = authorizationCode; + return this; + } + + public Builder clientCredentials(ClientCredentialsOAuthFlow clientCredentials) { + this.clientCredentials = clientCredentials; + return this; + } + + public Builder implicit(ImplicitOAuthFlow implicit) { + this.implicit = implicit; + return this; + } + + public Builder password(PasswordOAuthFlow password) { + this.password = password; + return this; + } + + public OAuthFlows build() { + return new OAuthFlows(authorizationCode, clientCredentials, implicit, password); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme.java new file mode 100644 index 000000000..6065ad539 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/OpenIdConnectSecurityScheme.java @@ -0,0 +1,64 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.OpenIdConnectSecurityScheme.OPENID_CONNECT; + +/** + * Defines a security scheme using OpenID Connect. + */ +public final class OpenIdConnectSecurityScheme implements SecurityScheme { + + public static final String OPENID_CONNECT = "openIdConnect"; + private final String openIdConnectUrl; + private final String description; + private final String type; + + public OpenIdConnectSecurityScheme(String openIdConnectUrl, String description) { + this(openIdConnectUrl, description, OPENID_CONNECT); + } + + public OpenIdConnectSecurityScheme(String openIdConnectUrl, String description, String type) { + Assert.checkNotNullParam("type", type); + Assert.checkNotNullParam("openIdConnectUrl", openIdConnectUrl); + if (!type.equals(OPENID_CONNECT)) { + throw new IllegalArgumentException("Invalid type for OpenIdConnectSecurityScheme"); + } + this.openIdConnectUrl = openIdConnectUrl; + this.description = description; + this.type = type; + } + + @Override + public String getDescription() { + return description; + } + + public String getOpenIdConnectUrl() { + return openIdConnectUrl; + } + + public String getType() { + return type; + } + + public static class Builder { + private String openIdConnectUrl; + private String description; + + public Builder openIdConnectUrl(String openIdConnectUrl) { + this.openIdConnectUrl = openIdConnectUrl; + return this; + } + + public Builder description(String description) { + this.description = description; + return this; + } + + public OpenIdConnectSecurityScheme build() { + return new OpenIdConnectSecurityScheme(openIdConnectUrl, description); + } + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part.java new file mode 100644 index 000000000..9ea21b9fa --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Part.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +/** + * A fundamental unit with a Message or Artifact. + * @param the type of unit + */ +public abstract class Part { + public enum Kind { + TEXT("text"), + FILE("file"), + DATA("data"); + + private final String kind; + + Kind(String kind) { + this.kind = kind; + } + + /** + * Returns the string representation of the kind for JSON serialization. + * + * @return the kind as a string + */ + public String asString() { + return this.kind; + } + } + + public abstract Kind getKind(); + + public abstract Map getMetadata(); + +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow.java new file mode 100644 index 000000000..d43d974f7 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PasswordOAuthFlow.java @@ -0,0 +1,16 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines configuration details for the OAuth 2.0 Resource Owner Password flow. + */ +public record PasswordOAuthFlow(String refreshUrl, Map scopes, String tokenUrl) { + + public PasswordOAuthFlow { + Assert.checkNotNullParam("scopes", scopes); + Assert.checkNotNullParam("tokenUrl", tokenUrl); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo.java new file mode 100644 index 000000000..334effbb6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationAuthenticationInfo.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import org.a2aproject.sdk.util.Assert; + +/** + * Defines authentication details for a push notification endpoint. + */ +public record PushNotificationAuthenticationInfo(List schemes, String credentials) { + + public PushNotificationAuthenticationInfo { + Assert.checkNotNullParam("schemes", schemes); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig.java new file mode 100644 index 000000000..6d4a66fee --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationConfig.java @@ -0,0 +1,54 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines the configuration for setting up push notifications for task updates. + */ +public record PushNotificationConfig(String url, String token, PushNotificationAuthenticationInfo authentication, String id) { + + public PushNotificationConfig { + Assert.checkNotNullParam("url", url); + } + + public static class Builder { + private String url; + private String token; + private PushNotificationAuthenticationInfo authentication; + private String id; + + public Builder() { + } + + public Builder(PushNotificationConfig notificationConfig) { + this.url = notificationConfig.url; + this.token = notificationConfig.token; + this.authentication = notificationConfig.authentication; + this.id = notificationConfig.id; + } + + public Builder url(String url) { + this.url = url; + return this; + } + + public Builder token(String token) { + this.token = token; + return this; + } + + public Builder authenticationInfo(PushNotificationAuthenticationInfo authenticationInfo) { + this.authentication = authenticationInfo; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public PushNotificationConfig build() { + return new PushNotificationConfig(url, token, authentication, id); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError.java new file mode 100644 index 000000000..65ac75789 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/PushNotificationNotSupportedError.java @@ -0,0 +1,25 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * An A2A-specific error indicating that the agent does not support push notifications. + */ +public class PushNotificationNotSupportedError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = -32003; + + public PushNotificationNotSupportedError() { + this(null, null, null); + } + + public PushNotificationNotSupportedError( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Push Notification is not supported"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme.java new file mode 100644 index 000000000..14235d617 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SecurityScheme.java @@ -0,0 +1,13 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.spec.APIKeySecurityScheme.API_KEY; + +/** + * Defines a security scheme that can be used to secure an agent's endpoints. + * This is a discriminated union type based on the OpenAPI 3.0 Security Scheme Object. + */ +public sealed interface SecurityScheme permits APIKeySecurityScheme, HTTPAuthSecurityScheme, OAuth2SecurityScheme, + OpenIdConnectSecurityScheme, MutualTLSSecurityScheme { + + String getDescription(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest.java new file mode 100644 index 000000000..563e6b931 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageRequest.java @@ -0,0 +1,84 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +/** + * Used to send a message request. + */ +public final class SendMessageRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "message/send"; + + /** + * Constructs a SendMessageRequest with the specified JSON-RPC fields. + *

+ * This constructor is used for JSON deserialization and validates + * that the method name is exactly "SendMessage". + * + * @param jsonrpc the JSON-RPC version (must be "2.0") + * @param id the request correlation identifier (String, Integer, or null) + * @param method the method name (must be {@value #METHOD}) + * @param params the message send parameters (required) + * @throws IllegalArgumentException if validation fails + */ + public SendMessageRequest(String jsonrpc, Object id, String method, MessageSendParams params) { + if (jsonrpc == null || jsonrpc.isEmpty()) { + throw new IllegalArgumentException("JSON-RPC protocol version cannot be null or empty"); + } + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public SendMessageRequest(Object id, MessageSendParams params) { + this(JSONRPC_VERSION, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method; + private MessageSendParams params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(MessageSendParams params) { + this.params = params; + return this; + } + + public SendMessageRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SendMessageRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse.java new file mode 100644 index 000000000..7f9fef232 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendMessageResponse.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a send message request. + */ +public final class SendMessageResponse extends JSONRPCResponse { + + public SendMessageResponse(String jsonrpc, Object id, EventKind result, JSONRPCError error) { + super(jsonrpc, id, result, error, EventKind.class); + } + + public SendMessageResponse(Object id, EventKind result) { + this(null, id, result, null); + } + + public SendMessageResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest.java new file mode 100644 index 000000000..66482aaff --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageRequest.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +import java.util.UUID; + +/** + * Used to initiate a task with streaming. + */ +public final class SendStreamingMessageRequest extends StreamingJSONRPCRequest { + + public static final String METHOD = "message/stream"; + + public SendStreamingMessageRequest(String jsonrpc, Object id, String method, MessageSendParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SendStreamingMessageRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public SendStreamingMessageRequest(Object id, MessageSendParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private MessageSendParams params; + + public Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public Builder id(Object id) { + this.id = id; + return this; + } + + public Builder method(String method) { + this.method = method; + return this; + } + + public Builder params(MessageSendParams params) { + this.params = params; + return this; + } + + public SendStreamingMessageRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SendStreamingMessageRequest(jsonrpc, id, method, params); + } + } + } diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse.java new file mode 100644 index 000000000..5bfe4509c --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SendStreamingMessageResponse.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a request to initiate a task with streaming. + */ +public final class SendStreamingMessageResponse extends JSONRPCResponse { + + public SendStreamingMessageResponse(String jsonrpc, Object id, StreamingEventKind result, JSONRPCError error) { + super(jsonrpc, id, result, error, StreamingEventKind.class); + } + + public SendStreamingMessageResponse(Object id, StreamingEventKind result) { + this(null, id, result, null); + } + + public SendStreamingMessageResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest.java new file mode 100644 index 000000000..2c0ab39eb --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigRequest.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import java.util.UUID; + +import org.a2aproject.sdk.util.Assert; + +/** + * Used to set a task push notification request. + */ +public final class SetTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest { + + public static final String METHOD = "tasks/pushNotificationConfig/set"; + + public SetTaskPushNotificationConfigRequest(String jsonrpc, Object id, String method, TaskPushNotificationConfig params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid SetTaskPushNotificationRequest method"); + } + Assert.checkNotNullParam("params", params); + Assert.isNullOrStringOrInteger(id); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id; + this.method = method; + this.params = params; + } + + public SetTaskPushNotificationConfigRequest(String id, TaskPushNotificationConfig taskPushConfig) { + this(null, id, METHOD, taskPushConfig); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskPushNotificationConfig params; + + public SetTaskPushNotificationConfigRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public SetTaskPushNotificationConfigRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public SetTaskPushNotificationConfigRequest.Builder method(String method) { + this.method = method; + return this; + } + + public SetTaskPushNotificationConfigRequest.Builder params(TaskPushNotificationConfig params) { + this.params = params; + return this; + } + + public SetTaskPushNotificationConfigRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new SetTaskPushNotificationConfigRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse.java new file mode 100644 index 000000000..c72a07374 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/SetTaskPushNotificationConfigResponse.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * The response after receiving a set task push notification request. + */ +public final class SetTaskPushNotificationConfigResponse extends JSONRPCResponse { + + public SetTaskPushNotificationConfigResponse(String jsonrpc, Object id, TaskPushNotificationConfig result, JSONRPCError error) { + super(jsonrpc, id, result, error, TaskPushNotificationConfig.class); + } + + public SetTaskPushNotificationConfigResponse(Object id, JSONRPCError error) { + this(null, id, null, error); + } + + public SetTaskPushNotificationConfigResponse(Object id, TaskPushNotificationConfig result) { + this(null, id, result, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind.java new file mode 100644 index 000000000..196e83c3d --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingEventKind.java @@ -0,0 +1,35 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Sealed interface for events that can be emitted during streaming A2A Protocol operations. + *

+ * StreamingEventKind represents events suitable for asynchronous, progressive updates during + * agent task execution. Streaming allows agents to provide incremental feedback as work progresses, + * rather than waiting until task completion. + *

+ * Streaming events use polymorphic JSON serialization with the "kind" discriminator to determine + * the concrete type during deserialization. + *

+ * Permitted implementations: + *

    + *
  • {@link Task} - Complete task state (typically the final event in a stream)
  • + *
  • {@link Message} - Full message (complete message in the stream)
  • + *
  • {@link TaskStatusUpdateEvent} - Incremental status updates (e.g., SUBMITTED → WORKING → COMPLETED)
  • + *
  • {@link TaskArtifactUpdateEvent} - Incremental artifact updates (partial results, chunks)
  • + *
+ *

+ * Streaming events enable patterns like: + *

    + *
  • Progressive text generation (chunks of response as generated)
  • + *
  • Status notifications (task state transitions)
  • + *
  • Partial results (early artifacts before task completion)
  • + *
+ * + * @see Event + * @see EventKind + * @see UpdateEvent + */ +public sealed interface StreamingEventKind extends Event permits Task, Message, TaskStatusUpdateEvent, TaskArtifactUpdateEvent { + + String getKind(); +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest.java new file mode 100644 index 000000000..03d5291cf --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StreamingJSONRPCRequest.java @@ -0,0 +1,10 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Represents a streaming JSON-RPC request. + */ + +public abstract sealed class StreamingJSONRPCRequest extends JSONRPCRequest permits TaskResubscriptionRequest, + SendStreamingMessageRequest { + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId.java new file mode 100644 index 000000000..4230b8c5a --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/StringJsonrpcId.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public class StringJsonrpcId { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task.java new file mode 100644 index 000000000..fd821e743 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/Task.java @@ -0,0 +1,138 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.List; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.Task.TASK; + +/** + * Represents a single, stateful operation or conversation between a client and an agent. + */ +public final class Task implements EventKind, StreamingEventKind { + + public static final String TASK = "task"; + private final String id; + private final String contextId; + private final TaskStatus status; + private final List artifacts; + private final List history; + private final Map metadata; + private final String kind; + + public Task(String id, String contextId, TaskStatus status, List artifacts, + List history, Map metadata) { + this(id, contextId, status, artifacts, history, metadata, TASK); + } + + public Task(String id, String contextId, TaskStatus status, + List artifacts, List history, + Map metadata, String kind) { + Assert.checkNotNullParam("id", id); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("status", status); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(TASK)) { + throw new IllegalArgumentException("Invalid Task"); + } + this.id = id; + this.contextId = contextId; + this.status = status; + this.artifacts = artifacts != null ? List.copyOf(artifacts) : List.of(); + this.history = history != null ? List.copyOf(history) : List.of(); + this.metadata = metadata; + this.kind = kind; + } + + public String getId() { + return id; + } + + public String getContextId() { + return contextId; + } + + public TaskStatus getStatus() { + return status; + } + + public List getArtifacts() { + return artifacts; + } + + public List getHistory() { + return history; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + private String id; + private String contextId; + private TaskStatus status; + private List artifacts; + private List history; + private Map metadata; + + public Builder() { + + } + + public Builder(Task task) { + id = task.id; + contextId = task.contextId; + status = task.status; + artifacts = task.artifacts; + history = task.history; + metadata = task.metadata; + + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder status(TaskStatus status) { + this.status = status; + return this; + } + + public Builder artifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + public Builder history(List history) { + this.history = history; + return this; + } + + public Builder history(Message... history) { + this.history = List.of(history); + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Task build() { + return new Task(id, contextId, status, artifacts, history, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent.java new file mode 100644 index 000000000..69f15378e --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskArtifactUpdateEvent.java @@ -0,0 +1,130 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent.ARTIFACT_UPDATE; + +/** + * An event sent by the agent to notify the client that an artifact has been + * generated or updated. This is typically used in streaming models. + */ +public final class TaskArtifactUpdateEvent implements EventKind, StreamingEventKind, UpdateEvent { + + public static final String ARTIFACT_UPDATE = "artifact-update"; + private final String taskId; + private final Boolean append; + private final Boolean lastChunk; + private final Artifact artifact; + private final String contextId; + private final Map metadata; + private final String kind; + + public TaskArtifactUpdateEvent(String taskId, Artifact artifact, String contextId, Boolean append, Boolean lastChunk, Map metadata) { + this(taskId, artifact, contextId, append, lastChunk, metadata, ARTIFACT_UPDATE); + } + + public TaskArtifactUpdateEvent(String taskId, Artifact artifact, String contextId, Boolean append, Boolean lastChunk, Map metadata, String kind) { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("artifact", artifact); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(ARTIFACT_UPDATE)) { + throw new IllegalArgumentException("Invalid TaskArtifactUpdateEvent"); + } + this.taskId = taskId; + this.artifact = artifact; + this.contextId = contextId; + this.append = append; + this.lastChunk = lastChunk; + this.metadata = metadata; + this.kind = kind; + } + + public String getTaskId() { + return taskId; + } + + public Artifact getArtifact() { + return artifact; + } + + public String getContextId() { + return contextId; + } + + public Boolean isAppend() { + return append; + } + + public Boolean isLastChunk() { + return lastChunk; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + + private String taskId; + private Artifact artifact; + private String contextId; + private Boolean append; + private Boolean lastChunk; + private Map metadata; + + public Builder() { + } + + public Builder(TaskArtifactUpdateEvent existingTaskArtifactUpdateEvent) { + this.taskId = existingTaskArtifactUpdateEvent.taskId; + this.artifact = existingTaskArtifactUpdateEvent.artifact; + this.contextId = existingTaskArtifactUpdateEvent.contextId; + this.append = existingTaskArtifactUpdateEvent.append; + this.lastChunk = existingTaskArtifactUpdateEvent.lastChunk; + this.metadata = existingTaskArtifactUpdateEvent.metadata; + } + + public Builder taskId(String taskId) { + this.taskId = taskId; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = artifact; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder append(Boolean append) { + this.append = append; + return this; + } + + public Builder lastChunk(Boolean lastChunk) { + this.lastChunk = lastChunk; + return this; + } + + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public TaskArtifactUpdateEvent build() { + return new TaskArtifactUpdateEvent(taskId, artifact, contextId, append, lastChunk, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams.java new file mode 100644 index 000000000..968d42d60 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskIdParams.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +/** + * Defines parameters containing a task ID, used for simple task operations. + */ +public record TaskIdParams(String id, Map metadata) { + + public TaskIdParams { + Assert.checkNotNullParam("id", id); + } + + public TaskIdParams(String id) { + this(id, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError.java new file mode 100644 index 000000000..95eb8dd76 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotCancelableError.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * An A2A-specific error indicating that the task is in a state where it cannot be canceled. + */ +public class TaskNotCancelableError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = -32002; + + public TaskNotCancelableError() { + this(null, null, null); + } + + public TaskNotCancelableError( + Integer code, + String message, + Object data) { + super( + defaultIfNull(code, DEFAULT_CODE), + defaultIfNull(message, "Task cannot be canceled"), + data); + } + + public TaskNotCancelableError(String message) { + this(null, message, null); + } + +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError.java new file mode 100644 index 000000000..18c98a56f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskNotFoundError.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * An A2A-specific error indicating that the requested task ID was not found. + */ +public class TaskNotFoundError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.TASK_NOT_FOUND_ERROR_CODE; + + public TaskNotFoundError() { + this(null, null, null); + } + + public TaskNotFoundError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.TASK_NOT_FOUND_ERROR_CODE), + defaultIfNull(message, "Task not found"), + data); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig.java new file mode 100644 index 000000000..ec03d412b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskPushNotificationConfig.java @@ -0,0 +1,14 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; + +/** + * A container associating a push notification configuration with a specific task. + */ +public record TaskPushNotificationConfig(String taskId, PushNotificationConfig pushNotificationConfig) { + + public TaskPushNotificationConfig { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("pushNotificationConfig", pushNotificationConfig); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams.java new file mode 100644 index 000000000..9fdb4d476 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskQueryParams.java @@ -0,0 +1,30 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.util.Assert; +import java.util.Map; +import org.jspecify.annotations.Nullable; + +/** + * Defines parameters for querying a task, with an option to limit history length. + * + * @param id the ID for the task to be queried + * @param historyLength the maximum number of items of history for the task to include in the response + * @param metadata additional properties + */ +public record TaskQueryParams(String id, int historyLength, @Nullable Map metadata) { + + public TaskQueryParams { + Assert.checkNotNullParam("id", id); + if (historyLength < 0) { + throw new IllegalArgumentException("Invalid history length"); + } + } + + public TaskQueryParams(String id) { + this(id, 0, null); + } + + public TaskQueryParams(String id, int historyLength) { + this(id, historyLength, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest.java new file mode 100644 index 000000000..26b68ecd4 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskResubscriptionRequest.java @@ -0,0 +1,68 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +import org.a2aproject.sdk.util.Assert; + +import java.util.UUID; + +/** + * Used to resubscribe to a task. + */ +public final class TaskResubscriptionRequest extends StreamingJSONRPCRequest { + + public static final String METHOD = "tasks/resubscribe"; + + public TaskResubscriptionRequest(String jsonrpc, Object id, String method, TaskIdParams params) { + if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) { + throw new IllegalArgumentException("Invalid JSON-RPC protocol version"); + } + Assert.checkNotNullParam("method", method); + if (! method.equals(METHOD)) { + throw new IllegalArgumentException("Invalid TaskResubscriptionRequest method"); + } + Assert.checkNotNullParam("params", params); + this.jsonrpc = defaultIfNull(jsonrpc, JSONRPC_VERSION); + this.id = id == null ? UUID.randomUUID().toString() : id; + this.method = method; + this.params = params; + } + + public TaskResubscriptionRequest(Object id, TaskIdParams params) { + this(null, id, METHOD, params); + } + + public static class Builder { + private String jsonrpc; + private Object id; + private String method = METHOD; + private TaskIdParams params; + + public TaskResubscriptionRequest.Builder jsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + return this; + } + + public TaskResubscriptionRequest.Builder id(Object id) { + this.id = id; + return this; + } + + public TaskResubscriptionRequest.Builder method(String method) { + this.method = method; + return this; + } + + public TaskResubscriptionRequest.Builder params(TaskIdParams params) { + this.params = params; + return this; + } + + public TaskResubscriptionRequest build() { + if (id == null) { + id = UUID.randomUUID().toString(); + } + return new TaskResubscriptionRequest(jsonrpc, id, method, params); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState.java new file mode 100644 index 000000000..ba1ac1437 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskState.java @@ -0,0 +1,69 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Defines the lifecycle states of a Task. + */ +public enum TaskState { + SUBMITTED("submitted"), + WORKING("working"), + INPUT_REQUIRED("input-required"), + AUTH_REQUIRED("auth-required"), + COMPLETED("completed", true), + CANCELED("canceled", true), + FAILED("failed", true), + REJECTED("rejected", true), + UNKNOWN("unknown", true); + + private final String state; + private final boolean isFinal; + + TaskState(String state) { + this(state, false); + } + + TaskState(String state, boolean isFinal) { + this.state = state; + this.isFinal = isFinal; + } + + /** + * Returns the string representation of this task state for JSON serialization. + *

+ * This method is used to serialize TaskState values to their + * wire format (e.g., "working", "completed"). + * + * @return the string representation of this state + */ + public String asString() { + return state; + } + + public boolean isFinal(){ + return isFinal; + } + + /** + * Deserializes a string value into a TaskState enum constant. + *

+ * This method is used to deserialize TaskState values from their + * wire format during JSON parsing. + * + * @param state the string representation of the state + * @return the corresponding TaskState enum constant + * @throws IllegalArgumentException if the state string is not recognized + */ + public static TaskState fromString(String state) { + return switch (state) { + case "submitted" -> SUBMITTED; + case "working" -> WORKING; + case "input-required" -> INPUT_REQUIRED; + case "auth-required" -> AUTH_REQUIRED; + case "completed" -> COMPLETED; + case "canceled" -> CANCELED; + case "failed" -> FAILED; + case "rejected" -> REJECTED; + case "unknown" -> UNKNOWN; + default -> throw new IllegalArgumentException("Invalid TaskState: " + state); + }; + } +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus.java new file mode 100644 index 000000000..742f80a3f --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatus.java @@ -0,0 +1,31 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +import org.a2aproject.sdk.util.Assert; + +/** + * Represents the status of a task at a specific point in time. + */ +public record TaskStatus(TaskState state, Message message, + OffsetDateTime timestamp) { + + public TaskStatus { + Assert.checkNotNullParam("state", state); + timestamp = timestamp == null ? OffsetDateTime.now(ZoneOffset.UTC) : timestamp; + } + + public TaskStatus(TaskState state) { + this(state, null, null); + } + + /** + * Constructor for testing purposes. + * @param state the task state + * @param timestamp timestamp generation + */ + TaskStatus(TaskState state, OffsetDateTime timestamp) { + this(state, null, timestamp); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent.java new file mode 100644 index 000000000..e1fa8ae3b --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TaskStatusUpdateEvent.java @@ -0,0 +1,118 @@ +package org.a2aproject.sdk.compat03.spec; + +import com.google.gson.annotations.SerializedName; +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent.STATUS_UPDATE; + +/** + * An event sent by the agent to notify the client of a change in a task's status. + * This is typically used in streaming or subscription models. + */ +public final class TaskStatusUpdateEvent implements EventKind, StreamingEventKind, UpdateEvent { + + public static final String STATUS_UPDATE = "status-update"; + private final String taskId; + private final TaskStatus status; + private final String contextId; + @SerializedName("final") + private final boolean isFinal; + private final Map metadata; + private final String kind; + + + public TaskStatusUpdateEvent(String taskId, TaskStatus status, String contextId, boolean isFinal, + Map metadata) { + this(taskId, status, contextId, isFinal, metadata, STATUS_UPDATE); + } + + public TaskStatusUpdateEvent(String taskId, TaskStatus status, String contextId, boolean isFinal, Map metadata, String kind) { + Assert.checkNotNullParam("taskId", taskId); + Assert.checkNotNullParam("status", status); + Assert.checkNotNullParam("contextId", contextId); + Assert.checkNotNullParam("kind", kind); + if (! kind.equals(STATUS_UPDATE)) { + throw new IllegalArgumentException("Invalid TaskStatusUpdateEvent"); + } + this.taskId = taskId; + this.status = status; + this.contextId = contextId; + this.isFinal = isFinal; + this.metadata = metadata; + this.kind = kind; + } + + public String getTaskId() { + return taskId; + } + + public TaskStatus getStatus() { + return status; + } + + public String getContextId() { + return contextId; + } + + public boolean isFinal() { + return isFinal; + } + + public Map getMetadata() { + return metadata; + } + + @Override + public String getKind() { + return kind; + } + + public static class Builder { + private String taskId; + private TaskStatus status; + private String contextId; + private boolean isFinal; + private Map metadata; + + public Builder() { + } + + public Builder(TaskStatusUpdateEvent existingTaskStatusUpdateEvent) { + this.taskId = existingTaskStatusUpdateEvent.taskId; + this.status = existingTaskStatusUpdateEvent.status; + this.contextId = existingTaskStatusUpdateEvent.contextId; + this.isFinal = existingTaskStatusUpdateEvent.isFinal; + this.metadata = existingTaskStatusUpdateEvent.metadata; + } + public Builder taskId(String id) { + this.taskId = id; + return this; + } + + public Builder status(TaskStatus status) { + this.status = status; + return this; + } + + public Builder contextId(String contextId) { + this.contextId = contextId; + return this; + } + + public Builder isFinal(boolean isFinal) { + this.isFinal = isFinal; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public TaskStatusUpdateEvent build() { + return new TaskStatusUpdateEvent(taskId, status, contextId, isFinal, metadata); + } + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart.java new file mode 100644 index 000000000..cd3ca05a6 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TextPart.java @@ -0,0 +1,43 @@ +package org.a2aproject.sdk.compat03.spec; + +import java.util.Map; + +import org.a2aproject.sdk.util.Assert; + +import static org.a2aproject.sdk.compat03.spec.TextPart.TEXT; + +/** + * Represents a text segment within a message or artifact. + */ +public class TextPart extends Part { + + public static final String TEXT = "text"; + private final String text; + private final Map metadata; + private final Kind kind; + + public TextPart(String text) { + this(text, null); + } + + public TextPart(String text, Map metadata) { + Assert.checkNotNullParam("text", text); + this.text = text; + this.metadata = metadata; + this.kind = Kind.TEXT; + } + + @Override + public Kind getKind() { + return kind; + } + + public String getText() { + return text; + } + + @Override + public Map getMetadata() { + return metadata; + } +} \ No newline at end of file diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol.java new file mode 100644 index 000000000..7fe8d8ca9 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/TransportProtocol.java @@ -0,0 +1,45 @@ +package org.a2aproject.sdk.compat03.spec; + +/** + * Supported A2A transport protocols. + */ +public enum TransportProtocol { + JSONRPC("JSONRPC"), + GRPC("GRPC"), + HTTP_JSON("HTTP+JSON"); + + private final String transport; + + TransportProtocol(String transport) { + this.transport = transport; + } + + /** + * Returns the string representation of this transport protocol. + *

+ * Used for JSON serialization. + * + * @return the transport protocol name as a string + */ + public String asString() { + return transport; + } + + /** + * Parses a string into a {@link TransportProtocol} enum constant. + *

+ * Used for JSON deserialization. + * + * @param transport the transport protocol string (e.g., "JSONRPC", "GRPC", "HTTP+JSON") + * @return the corresponding TransportProtocol enum constant + * @throws IllegalArgumentException if the transport string is not recognized + */ + public static TransportProtocol fromString(String transport) { + return switch (transport) { + case "JSONRPC" -> JSONRPC; + case "GRPC" -> GRPC; + case "HTTP+JSON" -> HTTP_JSON; + default -> throw new IllegalArgumentException("Invalid transport: " + transport); + }; + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError.java new file mode 100644 index 000000000..f6144b43a --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UnsupportedOperationError.java @@ -0,0 +1,22 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.a2aproject.sdk.compat03.util.Utils.defaultIfNull; + +/** + * An A2A-specific error indicating that the requested operation is not supported by the agent. + */ +public class UnsupportedOperationError extends JSONRPCError { + + public final static Integer DEFAULT_CODE = A2AErrorCodes.UNSUPPORTED_OPERATION_ERROR_CODE; + + public UnsupportedOperationError(Integer code, String message, Object data) { + super( + defaultIfNull(code, A2AErrorCodes.UNSUPPORTED_OPERATION_ERROR_CODE), + defaultIfNull(message, "This operation is not supported"), + data); + } + + public UnsupportedOperationError() { + this(null, null, null); + } +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent.java new file mode 100644 index 000000000..a8a165b98 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/spec/UpdateEvent.java @@ -0,0 +1,4 @@ +package org.a2aproject.sdk.compat03.spec; + +public sealed interface UpdateEvent permits TaskStatusUpdateEvent, TaskArtifactUpdateEvent { +} diff --git a/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils.java b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils.java new file mode 100644 index 000000000..f13a4a785 --- /dev/null +++ b/compat-0.3/spec/src/main/java/org/a2aproject/sdk/compat03/util/Utils.java @@ -0,0 +1,168 @@ +package org.a2aproject.sdk.compat03.util; + +import java.util.ArrayList; +import java.util.List; + +import com.google.gson.Gson; +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; + +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.Part; +import java.util.logging.Logger; + + + +/** + * Utility class providing common helper methods for A2A Protocol operations. + *

+ * This class contains static utility methods for JSON serialization/deserialization, + * null-safe operations, artifact management, and other common tasks used throughout + * the A2A Java SDK. + *

+ * Key capabilities: + *

    + *
  • JSON processing with pre-configured {@link Gson}
  • + *
  • Null-safe value defaults via {@link #defaultIfNull(Object, Object)}
  • + *
  • Artifact streaming support via {@link #appendArtifactToTask(Task, TaskArtifactUpdateEvent, String)}
  • + *
  • Type-safe exception rethrowing via {@link #rethrow(Throwable)}
  • + *
+ * + * @see Gson for JSON processing + * @see TaskArtifactUpdateEvent for streaming artifact updates + */ +public class Utils { + + + private static final Logger log = Logger.getLogger(Utils.class.getName()); + + /** + * Deserializes JSON string into a typed object using Gson. + *

+ * This method uses the pre-configured {@link JsonUtil#OBJECT_MAPPER} to parse JSON. + * + * @param the target type + * @param data JSON string to deserialize + * @param typeRef class reference specifying the target type + * @return deserialized object of type T + * @throws JsonProcessingException if JSON parsing fails + */ + public static T unmarshalFrom(String data, Class typeRef) throws JsonProcessingException { + return JsonUtil.fromJson(data, typeRef); + } + + public static String toJsonString(Object data) { + try { + return JsonUtil.toJson(data); + } catch (JsonProcessingException e) { + throw new RuntimeException("Failed to serialize to JSON", e); + } + } + + public static T defaultIfNull(T value, T defaultValue) { + if (value == null) { + return defaultValue; + } + return value; + } + + public static void rethrow(Throwable t) throws T { + throw (T) t; + } + + /** + * Appends or updates an artifact in a task based on a {@link TaskArtifactUpdateEvent}. + *

+ * This method handles streaming artifact updates, supporting both: + *

    + *
  • Adding new artifacts to the task
  • + *
  • Replacing existing artifacts (when {@code append=false})
  • + *
  • Appending parts to existing artifacts (when {@code append=true})
  • + *
+ *

+ * The {@code append} flag in the event determines the behavior: + *

    + *
  • {@code false} or {@code null}: Replace/add the entire artifact
  • + *
  • {@code true}: Append the new artifact's parts to an existing artifact with matching {@code artifactId}
  • + *
+ * + * @param task the current task to update + * @param event the artifact update event containing the new/updated artifact + * @param taskId the task ID (for logging purposes) + * @return a new Task instance with the updated artifacts list + * @see TaskArtifactUpdateEvent for streaming artifact updates + * @see Artifact for artifact structure + */ + public static Task appendArtifactToTask(Task task, TaskArtifactUpdateEvent event, String taskId) { + // Append artifacts + List artifacts = task.getArtifacts() == null ? new ArrayList<>() : new ArrayList<>(task.getArtifacts()); + + Artifact newArtifact = event.getArtifact(); + String artifactId = newArtifact.artifactId(); + boolean appendParts = event.isAppend() != null && event.isAppend(); + + Artifact existingArtifact = null; + int existingArtifactIndex = -1; + + for (int i = 0; i < artifacts.size(); i++) { + Artifact curr = artifacts.get(i); + if (curr.artifactId() != null && curr.artifactId().equals(artifactId)) { + existingArtifact = curr; + existingArtifactIndex = i; + break; + } + } + + if (!appendParts) { + // This represents the first chunk for this artifact index + if (existingArtifactIndex >= 0) { + // Replace the existing artifact entirely with the new artifact + log.fine(String.format("Replacing artifact at id %s for task %s", artifactId, taskId)); + artifacts.set(existingArtifactIndex, newArtifact); + } else { + // Append the new artifact since no artifact with this id/index exists yet + log.fine(String.format("Adding artifact at id %s for task %s", artifactId, taskId)); + artifacts.add(newArtifact); + } + + } else if (existingArtifact != null) { + // Append new parts to the existing artifact's parts list + // Do this to a copy + log.fine(String.format("Appending parts to artifact id %s for task %s", artifactId, taskId)); + List> parts = new ArrayList<>(existingArtifact.parts()); + parts.addAll(newArtifact.parts()); + Artifact updated = new Artifact.Builder(existingArtifact) + .parts(parts) + .build(); + artifacts.set(existingArtifactIndex, updated); + } else { + // We received a chunk to append, but we don't have an existing artifact. + // We will ignore this chunk + log.warning( + String.format("Received append=true for nonexistent artifact index for artifact %s in task %s. Ignoring chunk.", + artifactId, taskId)); + } + + return new Task.Builder(task) + .artifacts(artifacts) + .build(); + + } + + /** + * Get the first defined URL in the supported interaces of the agent card. + * + * @param agentCard the agentcard where the interfaces are defined. + * @return the first defined URL in the supported interaces of the agent card. + * @throws A2AClientException + */ +// public static String getFavoriteInterface(AgentCard agentCard) throws A2AClientException { +// if (agentCard.supportedInterfaces() == null || agentCard.supportedInterfaces().isEmpty()) { +// throw new A2AClientException("No server interface available in the AgentCard"); +// } +// return agentCard.supportedInterfaces().get(0).url(); +// } + +} diff --git a/compat-0.3/spec/src/main/resources/META-INF/beans.xml b/compat-0.3/spec/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..e69de29bb diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerializationTest.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerializationTest.java new file mode 100644 index 000000000..063ec3a37 --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/JSONRPCErrorSerializationTest.java @@ -0,0 +1,48 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; + + +public class JSONRPCErrorSerializationTest { + @Test + public void shouldDeserializeToCorrectJSONRPCErrorSubclass() throws JsonProcessingException { + String jsonTemplate = """ + {"code": %s, "message": "error", "data": "anything"} + """; + + record ErrorCase(int code, Class clazz) {} + + List cases = List.of( + new ErrorCase(JSONParseError.DEFAULT_CODE, JSONParseError.class), + new ErrorCase(InvalidRequestError.DEFAULT_CODE, InvalidRequestError.class), + new ErrorCase(MethodNotFoundError.DEFAULT_CODE, MethodNotFoundError.class), + new ErrorCase(InvalidParamsError.DEFAULT_CODE, InvalidParamsError.class), + new ErrorCase(InternalError.DEFAULT_CODE, InternalError.class), + new ErrorCase(PushNotificationNotSupportedError.DEFAULT_CODE, PushNotificationNotSupportedError.class), + new ErrorCase(UnsupportedOperationError.DEFAULT_CODE, UnsupportedOperationError.class), + new ErrorCase(ContentTypeNotSupportedError.DEFAULT_CODE, ContentTypeNotSupportedError.class), + new ErrorCase(InvalidAgentResponseError.DEFAULT_CODE, InvalidAgentResponseError.class), + new ErrorCase(TaskNotCancelableError.DEFAULT_CODE, TaskNotCancelableError.class), + new ErrorCase(TaskNotFoundError.DEFAULT_CODE, TaskNotFoundError.class), + new ErrorCase(Integer.MAX_VALUE, JSONRPCError.class) // Any unknown code will be treated as JSONRPCError + ); + + for (ErrorCase errorCase : cases) { + String json = jsonTemplate.formatted(errorCase.code()); + JSONRPCError error = JsonUtil.fromJson(json, JSONRPCError.class); + assertInstanceOf(errorCase.clazz(), error); + assertEquals("error", error.getMessage()); + assertEquals("anything", error.getData().toString()); + } + } + + +} diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerializationTest.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerializationTest.java new file mode 100644 index 000000000..d0b4ff4ce --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/SubTypeSerializationTest.java @@ -0,0 +1,102 @@ +package org.a2aproject.sdk.compat03.spec; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.Map; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class SubTypeSerializationTest { + + private static final Task MINIMAL_TASK = new Task.Builder() + .id("task-123") + .contextId("session-xyz") + .status(new TaskStatus(TaskState.SUBMITTED)) + .build(); + + @ParameterizedTest + @MethodSource("serializationTestCases") + void testSubtypeSerialization(Object objectToSerialize, String typePropertyName, String expectedTypeValue) throws JsonProcessingException { + String json = JsonUtil.toJson(objectToSerialize); + @SuppressWarnings("unchecked") + Map map = JsonUtil.fromJson(json, Map.class); + assertEquals(expectedTypeValue, map.get(typePropertyName)); + } + + private static Stream serializationTestCases() { + return Stream.of( + Arguments.of( + new TaskStatusUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus(TaskState.COMPLETED)) + .isFinal(true) + .build(), "kind", TaskStatusUpdateEvent.STATUS_UPDATE + ), + Arguments.of( + new TaskArtifactUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact.Builder() + .artifactId("11") + .parts(new TextPart("text")) + .build()) + .build(), "kind", TaskArtifactUpdateEvent.ARTIFACT_UPDATE + ), + Arguments.of( + MINIMAL_TASK, "kind", Task.TASK + ), + Arguments.of( + new Message.Builder() + .role(Message.Role.USER) + .parts(new TextPart("tell me some jokes")) + .contextId("context-1234") + .messageId("message-1234") + .build(), "kind", Message.MESSAGE + ), + Arguments.of( + new TextPart("text"), "kind", TextPart.TEXT + ), + Arguments.of( + new FilePart(new FileWithUri( + "image/jpeg", null, "file:///path/to/image.jpg")), + "kind", FilePart.FILE + ), + Arguments.of( + new DataPart(Map.of("chartType", "bar")), "kind", DataPart.DATA + ), + Arguments.of( + new APIKeySecurityScheme.Builder() + .in("test").name("name").description("description").build(), + "type", APIKeySecurityScheme.API_KEY + ), + Arguments.of( + new HTTPAuthSecurityScheme.Builder() + .scheme("basic").description("Basic Auth").build(), + "type", HTTPAuthSecurityScheme.HTTP + ), + Arguments.of( + new OAuth2SecurityScheme.Builder() + .flows(new OAuthFlows.Builder().build()) + .description("oAuth2SecurityScheme").build(), + "type", OAuth2SecurityScheme.OAUTH2 + ), + Arguments.of( + new OpenIdConnectSecurityScheme.Builder() + .openIdConnectUrl("https://accounts.google.com/.well-known/openid-configuration") + .description("OpenId").build(), + "type", OpenIdConnectSecurityScheme.OPENID_CONNECT + ), + Arguments.of( + new MutualTLSSecurityScheme("mutual tls test"), + "type", MutualTLSSecurityScheme.MUTUAL_TLS + ) + ); + } + +} diff --git a/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerializationTest.java b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerializationTest.java new file mode 100644 index 000000000..67ea1accd --- /dev/null +++ b/compat-0.3/spec/src/test/java/org/a2aproject/sdk/compat03/spec/TaskSerializationTest.java @@ -0,0 +1,713 @@ +package org.a2aproject.sdk.compat03.spec; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import org.a2aproject.sdk.compat03.json.JsonProcessingException; +import org.a2aproject.sdk.compat03.json.JsonUtil; + +/** + * Tests for Task serialization and deserialization using Gson. + */ +class TaskSerializationTest { + + @Test + void testBasicTaskSerialization() throws JsonProcessingException { + // Create a basic task + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.SUBMITTED)) + .build(); + + // Serialize to JSON + String json = JsonUtil.toJson(task); + + // Verify JSON contains expected fields + assertNotNull(json); + assertTrue(json.contains("\"id\":\"task-123\"")); + assertTrue(json.contains("\"state\":\"submitted\"")); + + // Deserialize back to Task + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify deserialized task matches original + assertEquals(task.getId(), deserialized.getId()); + assertEquals(task.getStatus().state(), deserialized.getStatus().state()); + } + + @Test + void testTaskWithTimestamp() throws JsonProcessingException { + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.WORKING, null, timestamp)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify OffsetDateTime timestamp is preserved + assertNotNull(deserialized.getStatus().timestamp()); + assertEquals(task.getStatus().timestamp(), deserialized.getStatus().timestamp()); + } + + @Test + void testTaskWithArtifacts() throws JsonProcessingException { + Artifact artifact = new Artifact.Builder() + .artifactId("artifact-1") + .name("Test Artifact") + .description("Description of artifact") + .parts(List.of( + new TextPart("Hello"), + new TextPart("World") + )) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains artifact data + assertTrue(json.contains("\"artifactId\":\"artifact-1\"")); + assertTrue(json.contains("Hello")); + assertTrue(json.contains("World")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify artifacts are preserved + assertNotNull(deserialized.getArtifacts()); + assertEquals(1, deserialized.getArtifacts().size()); + assertEquals("artifact-1", deserialized.getArtifacts().get(0).artifactId()); + assertEquals(2, deserialized.getArtifacts().get(0).parts().size()); + } + + @Test + void testTaskWithHistory() throws JsonProcessingException { + Message message = new Message.Builder() + .role(Message.Role.USER) + .parts(List.of(new TextPart("Test message"))) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.WORKING)) + .history(List.of(message)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains history data + assertTrue(json.contains("\"role\":\"user\"")); + assertTrue(json.contains("Test message")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify history is preserved + assertNotNull(deserialized.getHistory()); + assertEquals(1, deserialized.getHistory().size()); + assertEquals(Message.Role.USER, deserialized.getHistory().get(0).getRole()); + assertEquals(1, deserialized.getHistory().get(0).getParts().size()); + } + + @Test + void testTaskWithAllFields() throws JsonProcessingException { + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-789") + .status(new TaskStatus(TaskState.WORKING, null, timestamp)) + .history(List.of( + new Message.Builder() + .role(Message.Role.USER) + .parts(List.of(new TextPart("User message"))) + .build(), + new Message.Builder() + .role(Message.Role.AGENT) + .parts(List.of(new TextPart("Agent response"))) + .build() + )) + .artifacts(List.of( + new Artifact.Builder() + .artifactId("artifact-1") + .parts(List.of(new TextPart("Artifact content"))) + .build() + )) + .metadata(Map.of("key1", "value1", "key2", 42)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify all fields are preserved + assertEquals(task.getId(), deserialized.getId()); + assertEquals(task.getContextId(), deserialized.getContextId()); + assertEquals(task.getStatus().state(), deserialized.getStatus().state()); + assertEquals(task.getStatus().timestamp(), deserialized.getStatus().timestamp()); + assertEquals(task.getHistory().size(), deserialized.getHistory().size()); + assertEquals(task.getArtifacts().size(), deserialized.getArtifacts().size()); + assertNotNull(deserialized.getMetadata()); + assertEquals("value1", deserialized.getMetadata().get("key1")); + } + + @Test + void testTaskWithDifferentStates() throws JsonProcessingException { + for (TaskState state : TaskState.values()) { + Task task = new Task.Builder() + .id("task-" + state.asString()) + .contextId("context-123") + .status(new TaskStatus(state)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify state is serialized correctly + assertTrue(json.contains("\"state\":\"" + state.asString() + "\"")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify state is preserved + assertEquals(state, deserialized.getStatus().state()); + } + } + + @Test + void testTaskWithNullOptionalFields() throws JsonProcessingException { + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.SUBMITTED)) + // artifacts, history, metadata not set + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify required fields are present + assertEquals("task-123", deserialized.getId()); + assertEquals("context-456", deserialized.getContextId()); + assertEquals(TaskState.SUBMITTED, deserialized.getStatus().state()); + + // Verify optional lists default to empty + assertNotNull(deserialized.getArtifacts()); + assertEquals(0, deserialized.getArtifacts().size()); + assertNotNull(deserialized.getHistory()); + assertEquals(0, deserialized.getHistory().size()); + } + + @Test + void testTaskWithFilePartBytes() throws JsonProcessingException { + FilePart filePart = new FilePart(new FileWithBytes("application/pdf", "document.pdf", "base64data")); + + Artifact artifact = new Artifact.Builder() + .artifactId("file-artifact") + .parts(List.of(filePart)) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains file part data + assertTrue(json.contains("\"kind\":\"file\"")); + assertTrue(json.contains("document.pdf")); + assertTrue(json.contains("application/pdf")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify file part is preserved + Part part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart); + FilePart deserializedFilePart = (FilePart) part; + assertTrue(deserializedFilePart.getFile() instanceof FileWithBytes); + FileWithBytes fileWithBytes = (FileWithBytes) deserializedFilePart.getFile(); + assertEquals("document.pdf", fileWithBytes.name()); + assertEquals("application/pdf", fileWithBytes.mimeType()); + } + + @Test + void testTaskWithFilePartUri() throws JsonProcessingException { + FilePart filePart = new FilePart(new FileWithUri("image/png", "photo.png", "https://example.com/photo.png")); + + Artifact artifact = new Artifact.Builder() + .artifactId("uri-artifact") + .parts(List.of(filePart)) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains URI + assertTrue(json.contains("https://example.com/photo.png")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify file part URI is preserved + Part part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart); + FilePart deserializedFilePart = (FilePart) part; + assertTrue(deserializedFilePart.getFile() instanceof FileWithUri); + FileWithUri fileWithUri = (FileWithUri) deserializedFilePart.getFile(); + assertEquals("https://example.com/photo.png", fileWithUri.uri()); + } + + @Test + void testTaskWithDataPart() throws JsonProcessingException { + DataPart dataPart = new DataPart(Map.of("temperature", 22.5, "humidity", 65)); + + Artifact artifact = new Artifact.Builder() + .artifactId("data-artifact") + .parts(List.of(dataPart)) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains data part + assertTrue(json.contains("\"kind\":\"data\"")); + assertTrue(json.contains("temperature")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify data part is preserved + Part part = deserialized.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof DataPart); + DataPart deserializedDataPart = (DataPart) part; + assertNotNull(deserializedDataPart.getData()); + } + + @Test + void testTaskRoundTrip() throws JsonProcessingException { + // Create a comprehensive task with all part types + OffsetDateTime timestamp = OffsetDateTime.now(); + + Task original = new Task.Builder() + .id("task-123") + .contextId("context-789") + .status(new TaskStatus(TaskState.WORKING, null, timestamp)) + .history(List.of( + new Message.Builder() + .role(Message.Role.USER) + .parts(List.of( + new TextPart("Text"), + new FilePart(new FileWithBytes("text/plain", "file.txt", "data")), + new DataPart(Map.of("key", "value")) + )) + .build() + )) + .artifacts(List.of( + new Artifact.Builder() + .artifactId("artifact-1") + .parts(List.of(new TextPart("Content"))) + .build() + )) + .metadata(Map.of("meta1", "value1")) + .build(); + + // Serialize to JSON + String json = JsonUtil.toJson(original); + + // Deserialize back to Task + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Serialize again + String json2 = JsonUtil.toJson(deserialized); + + // Deserialize again + Task deserialized2 = JsonUtil.fromJson(json2, Task.class); + + // Verify multiple round-trips produce identical results + assertEquals(deserialized.getId(), deserialized2.getId()); + assertEquals(deserialized.getContextId(), deserialized2.getContextId()); + assertEquals(deserialized.getStatus().state(), deserialized2.getStatus().state()); + assertEquals(deserialized.getHistory().size(), deserialized2.getHistory().size()); + assertEquals(deserialized.getArtifacts().size(), deserialized2.getArtifacts().size()); + } + + @Test + void testTaskStatusWithMessage() throws JsonProcessingException { + Message statusMessage = new Message.Builder() + .role(Message.Role.AGENT) + .parts(List.of(new TextPart("Processing complete"))) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED, statusMessage, null)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Verify JSON contains status message + assertTrue(json.contains("\"state\":\"completed\"")); + assertTrue(json.contains("Processing complete")); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify status message is preserved + assertEquals(TaskState.COMPLETED, deserialized.getStatus().state()); + assertNotNull(deserialized.getStatus().message()); + assertEquals(Message.Role.AGENT, deserialized.getStatus().message().getRole()); + assertTrue(deserialized.getStatus().message().getParts().get(0) instanceof TextPart); + } + + @Test + void testDeserializeTaskFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "submitted" + }, + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertEquals("context-456", task.getContextId()); + assertEquals(TaskState.SUBMITTED, task.getStatus().state()); + assertNull(task.getStatus().message()); + // TaskStatus automatically sets timestamp to current time if not provided + assertNotNull(task.getStatus().timestamp()); + } + + @Test + void testDeserializeTaskWithArtifactsFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "artifact-1", + "name": "Result", + "parts": [ + { + "kind": "text", + "text": "Hello World" + } + ] + } + ], + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertEquals(TaskState.COMPLETED, task.getStatus().state()); + assertEquals(1, task.getArtifacts().size()); + assertEquals("artifact-1", task.getArtifacts().get(0).artifactId()); + assertEquals("Result", task.getArtifacts().get(0).name()); + assertEquals(1, task.getArtifacts().get(0).parts().size()); + assertTrue(task.getArtifacts().get(0).parts().get(0) instanceof TextPart); + assertEquals("Hello World", ((TextPart) task.getArtifacts().get(0).parts().get(0)).getText()); + } + + @Test + void testDeserializeTaskWithFilePartBytesFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "file-artifact", + "parts": [ + { + "kind": "file", + "file": { + "mimeType": "application/pdf", + "name": "document.pdf", + "bytes": "base64encodeddata" + } + } + ] + } + ], + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertEquals(1, task.getArtifacts().size()); + Part part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart); + FilePart filePart = (FilePart) part; + assertTrue(filePart.getFile() instanceof FileWithBytes); + FileWithBytes fileWithBytes = (FileWithBytes) filePart.getFile(); + assertEquals("application/pdf", fileWithBytes.mimeType()); + assertEquals("document.pdf", fileWithBytes.name()); + assertEquals("base64encodeddata", fileWithBytes.bytes()); + } + + @Test + void testDeserializeTaskWithFilePartUriFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "uri-artifact", + "parts": [ + { + "kind": "file", + "file": { + "mimeType": "image/png", + "name": "photo.png", + "uri": "https://example.com/photo.png" + } + } + ] + } + ], + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + Part part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof FilePart); + FilePart filePart = (FilePart) part; + assertTrue(filePart.getFile() instanceof FileWithUri); + FileWithUri fileWithUri = (FileWithUri) filePart.getFile(); + assertEquals("image/png", fileWithUri.mimeType()); + assertEquals("photo.png", fileWithUri.name()); + assertEquals("https://example.com/photo.png", fileWithUri.uri()); + } + + @Test + void testDeserializeTaskWithDataPartFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "artifacts": [ + { + "artifactId": "data-artifact", + "parts": [ + { + "kind": "data", + "data": { + "temperature": 22.5, + "humidity": 65 + } + } + ] + } + ], + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + Part part = task.getArtifacts().get(0).parts().get(0); + assertTrue(part instanceof DataPart); + DataPart dataPart = (DataPart) part; + assertNotNull(dataPart.getData()); + } + + @Test + void testDeserializeTaskWithHistoryFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working" + }, + "history": [ + { + "role": "user", + "parts": [ + { + "kind": "text", + "text": "User message" + } + ] + }, + { + "role": "agent", + "parts": [ + { + "kind": "text", + "text": "Agent response" + } + ] + } + ], + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertEquals(2, task.getHistory().size()); + assertEquals(Message.Role.USER, task.getHistory().get(0).getRole()); + assertEquals(Message.Role.AGENT, task.getHistory().get(1).getRole()); + assertTrue(task.getHistory().get(0).getParts().get(0) instanceof TextPart); + assertEquals("User message", ((TextPart) task.getHistory().get(0).getParts().get(0)).getText()); + } + + @Test + void testDeserializeTaskWithTimestampFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "working", + "timestamp": "2023-10-01T12:00:00.234-05:00" + }, + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertEquals(TaskState.WORKING, task.getStatus().state()); + assertNotNull(task.getStatus().timestamp()); + assertEquals("2023-10-01T12:00:00.234-05:00", task.getStatus().timestamp().toString()); + } + + @Test + void testDeserializeTaskWithMetadataFromJson() throws JsonProcessingException { + String json = """ + { + "id": "task-123", + "contextId": "context-456", + "status": { + "state": "completed" + }, + "metadata": { + "key1": "value1", + "key2": 42 + }, + "kind": "task" + } + """; + + Task task = JsonUtil.fromJson(json, Task.class); + + assertEquals("task-123", task.getId()); + assertNotNull(task.getMetadata()); + assertEquals("value1", task.getMetadata().get("key1")); + } + + @Test + void testTaskWithMixedPartTypes() throws JsonProcessingException { + Artifact artifact = new Artifact.Builder() + .artifactId("mixed-artifact") + .parts(List.of( + new TextPart("Text content"), + new FilePart(new FileWithBytes("application/json", "data.json", "{}")), + new DataPart(Map.of("result", 42)), + new FilePart(new FileWithUri("image/png", "image.png", "https://example.com/img.png")) + )) + .build(); + + Task task = new Task.Builder() + .id("task-123") + .contextId("context-456") + .status(new TaskStatus(TaskState.COMPLETED)) + .artifacts(List.of(artifact)) + .build(); + + // Serialize + String json = JsonUtil.toJson(task); + + // Deserialize + Task deserialized = JsonUtil.fromJson(json, Task.class); + + // Verify all part types are preserved + List> parts = deserialized.getArtifacts().get(0).parts(); + assertEquals(4, parts.size()); + assertTrue(parts.get(0) instanceof TextPart); + assertTrue(parts.get(1) instanceof FilePart); + assertTrue(parts.get(2) instanceof DataPart); + assertTrue(parts.get(3) instanceof FilePart); + } +} diff --git a/compat-0.3/tck/pom.xml b/compat-0.3/tck/pom.xml new file mode 100644 index 000000000..e38f1904f --- /dev/null +++ b/compat-0.3/tck/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + .. + + + a2a-compat-0.3-tck-server + + Java SDK A2A Compat 0.3 TCK Server + Server example to use with the A2A TCK + + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-jsonrpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-reference-rest + + + io.quarkus + quarkus-rest-jackson + provided + + + jakarta.enterprise + jakarta.enterprise.cdi-api + provided + + + jakarta.ws.rs + jakarta.ws.rs-api + + + + + + + io.quarkus + quarkus-maven-plugin + true + + + + build + generate-code + generate-code-tests + + + + + + + diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer.java new file mode 100644 index 000000000..0ea1c495d --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentCardProducer.java @@ -0,0 +1,61 @@ +package org.a2aproject.sdk.compat03.tck.server; + +import java.util.Collections; +import java.util.List; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AgentInterface; +import org.a2aproject.sdk.compat03.spec.AgentSkill; +import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +@ApplicationScoped +public class AgentCardProducer { + + private static final String DEFAULT_SUT_URL = "http://localhost:9999"; + + @Produces + @PublicAgentCard + public AgentCard agentCard() { + + String sutJsonRpcUrl = getEnvOrDefault("SUT_JSONRPC_URL", DEFAULT_SUT_URL); + String sutGrpcUrl = getEnvOrDefault("SUT_GRPC_URL", DEFAULT_SUT_URL); + String sutRestcUrl = getEnvOrDefault("SUT_REST_URL", DEFAULT_SUT_URL); + return new AgentCard.Builder() + .name("Hello World Agent") + .description("Just a hello world agent") + .url(sutJsonRpcUrl) + .version("1.0.0") + .documentationUrl("http://example.com/docs") + .capabilities(new AgentCapabilities.Builder() + .streaming(true) + .pushNotifications(true) + .stateTransitionHistory(true) + .build()) + .defaultInputModes(Collections.singletonList("text")) + .defaultOutputModes(Collections.singletonList("text")) + .skills(Collections.singletonList(new AgentSkill.Builder() + .id("hello_world") + .name("Returns hello world") + .description("just returns hello world") + .tags(Collections.singletonList("hello world")) + .examples(List.of("hi", "hello world")) + .build())) + .protocolVersion("0.3.0") + .additionalInterfaces(List.of( + new AgentInterface(TransportProtocol.JSONRPC.asString(), sutJsonRpcUrl), + new AgentInterface(TransportProtocol.GRPC.asString(), sutGrpcUrl), + new AgentInterface(TransportProtocol.HTTP_JSON.asString(), sutRestcUrl))) + .build(); + } + + private static String getEnvOrDefault(String envVar, String defaultValue) { + String value = System.getenv(envVar); + return value == null || value.isBlank() ? defaultValue : value; + } +} + diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer.java new file mode 100644 index 000000000..c5c33319b --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/AgentExecutorProducer.java @@ -0,0 +1,82 @@ +package org.a2aproject.sdk.compat03.tck.server; + +import jakarta.annotation.PreDestroy; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; + +import org.a2aproject.sdk.server.agentexecution.AgentExecutor; +import org.a2aproject.sdk.server.agentexecution.RequestContext; +import org.a2aproject.sdk.server.tasks.AgentEmitter; +import org.a2aproject.sdk.spec.A2AError; +import org.a2aproject.sdk.spec.Message; +import org.a2aproject.sdk.spec.Task; +import org.a2aproject.sdk.spec.TaskNotCancelableError; +import org.a2aproject.sdk.spec.TaskState; +import org.a2aproject.sdk.util.Assert; + +@ApplicationScoped +public class AgentExecutorProducer { + + @Produces + public AgentExecutor agentExecutor() { + return new FireAndForgetAgentExecutor(); + } + + private static class FireAndForgetAgentExecutor implements AgentExecutor { + @Override + public void execute(RequestContext context, AgentEmitter emitter) throws A2AError { + Task task = context.getTask(); + + if (task == null) { + emitter.submit(); + } + + // Sleep to allow task state persistence before TCK resubscribe test + Message message = context.getMessage(); + if (message != null && message.messageId().startsWith("test-resubscribe-message-id")) { + int timeoutMs = Integer.parseInt(System.getenv().getOrDefault("RESUBSCRIBE_TIMEOUT_MS", "3000")); + System.out.println("====> task id starts with test-resubscribe-message-id, sleeping for " + timeoutMs + " ms"); + try { + Thread.sleep(timeoutMs); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + + // Immediately set to WORKING state + emitter.startWork(); + System.out.println("====> task set to WORKING, starting background execution"); + + // Method returns immediately - task continues in background + System.out.println("====> execute() method returning immediately, task running in background"); + } + + @Override + public void cancel(RequestContext context, AgentEmitter emitter) throws A2AError { + System.out.println("====> task cancel request received"); + Task task = Assert.checkNotNullParam("task", context.getTask()); + + if (task.status().state() == TaskState.TASK_STATE_CANCELED) { + System.out.println("====> task already canceled"); + throw new TaskNotCancelableError(); + } + + if (task.status().state() == TaskState.TASK_STATE_COMPLETED) { + System.out.println("====> task already completed"); + throw new TaskNotCancelableError(); + } + + emitter.cancel(); + + System.out.println("====> task canceled"); + } + + /** + * Cleanup method for proper resource management + */ + @PreDestroy + public void cleanup() { + System.out.println("====> shutting down task executor"); + } + } +} \ No newline at end of file diff --git a/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java new file mode 100644 index 000000000..4539f9136 --- /dev/null +++ b/compat-0.3/tck/src/main/java/org/a2aproject/sdk/compat03/tck/server/package-info.java @@ -0,0 +1,10 @@ +@NullMarked +package org.a2aproject.sdk.compat03.tck.server; + +import org.jspecify.annotations.NullMarked; + +//The following had @Nullable annotation applied from JSpecify +//AgentCardProducer.java getEnvOrDefault method, +//AgentExecutorProducer.java execute method +// + diff --git a/compat-0.3/transport/grpc/pom.xml b/compat-0.3/transport/grpc/pom.xml new file mode 100644 index 000000000..33f13d442 --- /dev/null +++ b/compat-0.3/transport/grpc/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-grpc + + jar + + Java SDK A2A Compat 0.3 Transport: gRPC + Java SDK for the Agent2Agent Protocol (A2A) - gRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + com.google.protobuf + protobuf-java + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + io.grpc + grpc-testing + test + + + + + diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys.java new file mode 100644 index 000000000..2d8ccc2e9 --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/context/GrpcContextKeys.java @@ -0,0 +1,45 @@ +package org.a2aproject.sdk.compat03.transport.grpc.context; + +import io.grpc.Context; + +/** + * Shared gRPC context keys for A2A protocol data. + * + * These keys provide access to gRPC context information similar to + * Python's grpc.aio.ServicerContext, enabling rich context access + * in service method implementations. + */ +public final class GrpcContextKeys { + + /** + * Context key for storing the X-A2A-Extensions header value. + * Set by server interceptors and accessed by service handlers. + */ + public static final Context.Key EXTENSIONS_HEADER_KEY = + Context.key("x-a2a-extensions"); + + /** + * Context key for storing the complete gRPC Metadata object. + * Provides access to all request headers and metadata. + */ + public static final Context.Key METADATA_KEY = + Context.key("grpc-metadata"); + + /** + * Context key for storing the method name being called. + * Equivalent to Python's context.method() functionality. + */ + public static final Context.Key METHOD_NAME_KEY = + Context.key("grpc-method-name"); + + /** + * Context key for storing the peer information. + * Provides access to client connection details. + */ + public static final Context.Key PEER_INFO_KEY = + Context.key("grpc-peer-info"); + + private GrpcContextKeys() { + // Utility class + } +} diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory.java new file mode 100644 index 000000000..222f674e1 --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/CallContextFactory.java @@ -0,0 +1,12 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import org.a2aproject.sdk.server.ServerCallContext; +import io.grpc.stub.StreamObserver; + +/** + * Factory interface for creating ServerCallContext from gRPC StreamObserver. + * Implementations can provide custom context creation logic. + */ +public interface CallContextFactory { + ServerCallContext create(StreamObserver responseObserver); +} diff --git a/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler.java b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler.java new file mode 100644 index 000000000..4a92aef7e --- /dev/null +++ b/compat-0.3/transport/grpc/src/main/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandler.java @@ -0,0 +1,392 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils.FromProto; +import static org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils.ToProto; + +import jakarta.enterprise.inject.Vetoed; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; + +import com.google.protobuf.Empty; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.a2aproject.sdk.server.auth.User; +import org.a2aproject.sdk.spec.A2AError; +import io.grpc.Status; +import io.grpc.stub.StreamObserver; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Abstract gRPC handler for v0.3 protocol with translation layer to v1.0. + */ +@Vetoed +public abstract class GrpcHandler extends org.a2aproject.sdk.compat03.grpc.A2AServiceGrpc.A2AServiceImplBase { + + private Convert03To10RequestHandler requestHandler; + + protected abstract AgentCard getAgentCard(); + + protected abstract CallContextFactory getCallContextFactory(); + + protected abstract Executor getExecutor(); + + protected Convert03To10RequestHandler getRequestHandler() { + return requestHandler; + } + + protected void setRequestHandler(Convert03To10RequestHandler requestHandler) { + this.requestHandler = requestHandler; + } + + @Override + public void sendMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + MessageSendParams params = FromProto.messageSendParams(request); + EventKind taskOrMessage = requestHandler.onMessageSend(params, context); + org.a2aproject.sdk.compat03.grpc.SendMessageResponse response = ToProto.taskOrMessage(taskOrMessage); + responseObserver.onNext(response); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void getTask(org.a2aproject.sdk.compat03.grpc.GetTaskRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + TaskQueryParams params = FromProto.taskQueryParams(request); + Task task = requestHandler.onGetTask(params, context); + if (task != null) { + responseObserver.onNext(ToProto.task(task)); + responseObserver.onCompleted(); + } else { + handleError(responseObserver, new TaskNotFoundError()); + } + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void cancelTask(org.a2aproject.sdk.compat03.grpc.CancelTaskRequest request, + StreamObserver responseObserver) { + try { + ServerCallContext context = createCallContext(responseObserver); + TaskIdParams params = FromProto.taskIdParams(request); + Task task = requestHandler.onCancelTask(params, context); + if (task != null) { + responseObserver.onNext(ToProto.task(task)); + responseObserver.onCompleted(); + } else { + handleError(responseObserver, new TaskNotFoundError()); + } + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void createTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + TaskPushNotificationConfig config = FromProto.taskPushNotificationConfig(request); + TaskPushNotificationConfig responseConfig = requestHandler.onSetTaskPushNotificationConfig(config, context); + responseObserver.onNext(ToProto.taskPushNotificationConfig(responseConfig)); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void getTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + GetTaskPushNotificationConfigParams params = FromProto.getTaskPushNotificationConfigParams(request); + TaskPushNotificationConfig config = requestHandler.onGetTaskPushNotificationConfig(params, context); + responseObserver.onNext(ToProto.taskPushNotificationConfig(config)); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void listTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + ListTaskPushNotificationConfigParams params = FromProto.listTaskPushNotificationConfigParams(request); + List configList = requestHandler.onListTaskPushNotificationConfig(params, context); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.Builder responseBuilder = + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(); + for (TaskPushNotificationConfig config : configList) { + responseBuilder.addConfigs(ToProto.taskPushNotificationConfig(config)); + } + responseObserver.onNext(responseBuilder.build()); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void sendStreamingMessage(org.a2aproject.sdk.compat03.grpc.SendMessageRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().streaming()) { + handleError(responseObserver, new InvalidRequestError("Streaming is not supported by the agent")); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + MessageSendParams params = FromProto.messageSendParams(request); + Flow.Publisher publisher = requestHandler.onMessageSendStream(params, context); + convertToStreamResponse(publisher, responseObserver); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void taskSubscription(org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().streaming()) { + handleError(responseObserver, new InvalidRequestError("Streaming is not supported by the agent")); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + TaskIdParams params = FromProto.taskIdParams(request); + Flow.Publisher publisher = requestHandler.onResubscribeToTask(params, context); + convertToStreamResponse(publisher, responseObserver); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + private void convertToStreamResponse(Flow.Publisher publisher, + StreamObserver responseObserver) { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind event) { + org.a2aproject.sdk.compat03.grpc.StreamResponse response = ToProto.streamResponse(event); + responseObserver.onNext(response); + if (response.hasStatusUpdate() && response.getStatusUpdate().getFinal()) { + responseObserver.onCompleted(); + } else { + subscription.request(1); + } + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof A2AError a2aError) { + handleError(responseObserver, ErrorConverter.convertA2AError(a2aError)); + } else if (throwable instanceof JSONRPCError jsonrpcError) { + handleError(responseObserver, jsonrpcError); + } else { + handleInternalError(responseObserver, throwable); + } + responseObserver.onCompleted(); + } + + @Override + public void onComplete() { + responseObserver.onCompleted(); + } + }); + }, getExecutor()); + } + + @Override + public void getAgentCard(org.a2aproject.sdk.compat03.grpc.GetAgentCardRequest request, + StreamObserver responseObserver) { + try { + responseObserver.onNext(ToProto.agentCard(getAgentCard())); + responseObserver.onCompleted(); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + @Override + public void deleteTaskPushNotificationConfig(org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request, + StreamObserver responseObserver) { + if (!getAgentCard().capabilities().pushNotifications()) { + handleError(responseObserver, new PushNotificationNotSupportedError()); + return; + } + + try { + ServerCallContext context = createCallContext(responseObserver); + DeleteTaskPushNotificationConfigParams params = FromProto.deleteTaskPushNotificationConfigParams(request); + requestHandler.onDeleteTaskPushNotificationConfig(params, context); + // void response + responseObserver.onNext(Empty.getDefaultInstance()); + responseObserver.onCompleted(); + } catch (A2AError e) { + handleError(responseObserver, ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + handleError(responseObserver, e); + } catch (Throwable t) { + handleInternalError(responseObserver, t); + } + } + + private ServerCallContext createCallContext(StreamObserver responseObserver) { + CallContextFactory factory = getCallContextFactory(); + if (factory == null) { + // Default implementation when no custom CallContextFactory is provided + User user = UnauthenticatedUser.INSTANCE; + Map state = new HashMap<>(); + state.put("grpc_response_observer", responseObserver); + Set requestedExtensions = new HashSet<>(); + return new ServerCallContext(user, state, requestedExtensions); + } else { + return factory.create(responseObserver); + } + } + + private void handleError(StreamObserver responseObserver, JSONRPCError error) { + Status status; + String description; + if (error instanceof InvalidRequestError) { + status = Status.INVALID_ARGUMENT; + description = "InvalidRequestError: " + error.getMessage(); + } else if (error instanceof MethodNotFoundError) { + status = Status.NOT_FOUND; + description = "MethodNotFoundError: " + error.getMessage(); + } else if (error instanceof InvalidParamsError) { + status = Status.INVALID_ARGUMENT; + description = "InvalidParamsError: " + error.getMessage(); + } else if (error instanceof InternalError) { + status = Status.INTERNAL; + description = "InternalError: " + error.getMessage(); + } else if (error instanceof TaskNotFoundError) { + status = Status.NOT_FOUND; + description = "TaskNotFoundError: " + error.getMessage(); + } else if (error instanceof TaskNotCancelableError) { + status = Status.UNIMPLEMENTED; + description = "TaskNotCancelableError: " + error.getMessage(); + } else if (error instanceof PushNotificationNotSupportedError) { + status = Status.UNIMPLEMENTED; + description = "PushNotificationNotSupportedError: " + error.getMessage(); + } else if (error instanceof UnsupportedOperationError) { + status = Status.UNIMPLEMENTED; + description = "UnsupportedOperationError: " + error.getMessage(); + } else if (error instanceof JSONParseError) { + status = Status.INTERNAL; + description = "JSONParseError: " + error.getMessage(); + } else if (error instanceof ContentTypeNotSupportedError) { + status = Status.UNIMPLEMENTED; + description = "ContentTypeNotSupportedError: " + error.getMessage(); + } else if (error instanceof InvalidAgentResponseError) { + status = Status.INTERNAL; + description = "InvalidAgentResponseError: " + error.getMessage(); + } else { + status = Status.UNKNOWN; + description = "Unknown error type: " + error.getMessage(); + } + responseObserver.onError(status.withDescription(description).asRuntimeException()); + } + + private void handleInternalError(StreamObserver responseObserver, Throwable t) { + handleError(responseObserver, new InternalError(t.getMessage())); + } +} diff --git a/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandlerTest.java b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandlerTest.java new file mode 100644 index 000000000..f6c6e778e --- /dev/null +++ b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcHandlerTest.java @@ -0,0 +1,542 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +// gRPC test imports +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import io.grpc.testing.StreamRecorder; + +// v0.3 gRPC proto imports +import org.a2aproject.sdk.compat03.grpc.CancelTaskRequest; +import org.a2aproject.sdk.compat03.grpc.GetTaskRequest; +import org.a2aproject.sdk.compat03.grpc.Message; +import org.a2aproject.sdk.compat03.grpc.Part; +import org.a2aproject.sdk.compat03.grpc.Role; +import org.a2aproject.sdk.compat03.grpc.SendMessageRequest; +import org.a2aproject.sdk.compat03.grpc.SendMessageResponse; +import org.a2aproject.sdk.compat03.grpc.StreamResponse; +import org.a2aproject.sdk.compat03.grpc.Task; +import org.a2aproject.sdk.compat03.grpc.TaskState; +import org.a2aproject.sdk.compat03.grpc.TaskSubscriptionRequest; + +/** + * Test suite for v0.3 GrpcHandler with v1.0 backend. + *

+ * Tests verify that v0.3 gRPC clients can successfully communicate with the v1.0 backend + * via the {@link org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler} conversion layer. + *

+ *

+ * Phase 3 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests are deferred to Phase 4. + *

+ */ +public class GrpcHandlerTest extends AbstractA2ARequestHandlerTest { + + // gRPC Message fixture (protobuf format) + private static final Message GRPC_MESSAGE = Message.newBuilder() + .setTaskId(MINIMAL_TASK.getId()) + .setContextId(MINIMAL_TASK.getContextId()) + .setMessageId(MESSAGE.getMessageId()) + .setRole(Role.ROLE_AGENT) + .addContent(Part.newBuilder().setText(((org.a2aproject.sdk.compat03.spec.TextPart) MESSAGE.getParts().get(0)).getText()).build()) + .build(); + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testOnGetTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + GetTaskRequest request = GetTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + Task task = result.get(0); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + } + + @Test + public void testOnGetTaskNotFound() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + GetTaskRequest request = GetTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.NOT_FOUND); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testOnCancelTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + Task task = result.get(0); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + assertEquals(TaskState.TASK_STATE_CANCELLED, task.getStatus().getState()); + } + + @Test + public void testOnCancelTaskNotSupported() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw UnsupportedOperationError + agentExecutorCancel = (context, emitter) -> { + throw new org.a2aproject.sdk.spec.UnsupportedOperationError(); + }; + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED); + } + + @Test + public void testOnCancelTaskNotFound() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + CancelTaskRequest request = CancelTaskRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.cancelTask(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertGrpcError(streamRecorder, Status.Code.NOT_FOUND); + } + + // ======================================== + // SendMessage Tests (Non-Streaming) + // ======================================== + + @Test + public void testOnMessageNewMessageSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + SendMessageResponse response = result.get(0); + Assertions.assertTrue(response.hasMsg()); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testOnMessageNewMessageWithExistingTaskSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save existing task + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit message + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + Assertions.assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + Assertions.assertEquals(1, result.size()); + SendMessageResponse response = result.get(0); + Assertions.assertTrue(response.hasMsg()); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testOnMessageError() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Configure agent to throw error + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(new org.a2aproject.sdk.spec.UnsupportedOperationError()); + }; + + StreamRecorder streamRecorder = sendMessageRequest(handler); + + assertGrpcError(streamRecorder, Status.Code.UNIMPLEMENTED); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testOnMessageStreamNewMessageSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Configure agent to emit the message back (v1.0 context contains v1.0 Message) + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + assertNull(streamRecorder.getError(), "No error should occur"); + List result = streamRecorder.getValues(); + assertNotNull(result, "Result should not be null"); + assertEquals(1, result.size(), "Should receive exactly 1 event"); + + StreamResponse response = result.get(0); + assertTrue(response.hasMsg(), "Response should contain a message"); + Message message = response.getMsg(); + assertEquals(GRPC_MESSAGE.getMessageId(), message.getMessageId()); + } + + @Test + public void testStreamingNotSupportedError() throws Exception { + // Create agent card with streaming disabled + org.a2aproject.sdk.compat03.spec.AgentCard nonStreamingCard = + new org.a2aproject.sdk.compat03.spec.AgentCard.Builder(CARD) + .capabilities(new org.a2aproject.sdk.compat03.spec.AgentCapabilities(false, true, false, null)) + .build(); + + TestGrpcHandler handler = new TestGrpcHandler(nonStreamingCard, convert03To10Handler, internalExecutor); + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + // Should receive INVALID_ARGUMENT status + assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT); + } + + @Test + public void testStreamingNotSupportedErrorOnResubscribeToTask() throws Exception { + // Create agent card with streaming disabled + org.a2aproject.sdk.compat03.spec.AgentCard nonStreamingCard = + new org.a2aproject.sdk.compat03.spec.AgentCard.Builder(CARD) + .capabilities(new org.a2aproject.sdk.compat03.spec.AgentCapabilities(false, true, false, null)) + .build(); + + TestGrpcHandler handler = new TestGrpcHandler(nonStreamingCard, convert03To10Handler, internalExecutor); + + TaskSubscriptionRequest request = TaskSubscriptionRequest.newBuilder() + .setName("tasks/" + MINIMAL_TASK.getId()) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.taskSubscription(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + // Should receive INVALID_ARGUMENT status + assertGrpcError(streamRecorder, Status.Code.INVALID_ARGUMENT); + } + + @Test + public void testOnMessageStreamInternalError() throws Exception { + // Mock the Convert03To10RequestHandler to throw InternalError + Convert03To10RequestHandler mockedHandler = Mockito.mock(Convert03To10RequestHandler.class); + Mockito.doThrow(new org.a2aproject.sdk.spec.InternalError("Internal Error")) + .when(mockedHandler) + .onMessageSendStream( + Mockito.any(org.a2aproject.sdk.compat03.spec.MessageSendParams.class), + Mockito.any(ServerCallContext.class)); + + TestGrpcHandler handler = new TestGrpcHandler(CARD, mockedHandler, internalExecutor); + + StreamRecorder streamRecorder = sendStreamingMessageRequest(handler); + + // Should receive INTERNAL status + assertGrpcError(streamRecorder, Status.Code.INTERNAL); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testSetPushNotificationConfigSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/config456"; + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertNotNull(result); + assertEquals(1, result.size()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig response = result.get(0); + assertEquals(NAME, response.getName()); + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig responseConfig = response.getPushNotificationConfig(); + assertEquals("config456", responseConfig.getId()); + assertEquals("http://example.com", responseConfig.getUrl()); + } + + @Test + public void testGetPushNotificationConfigSuccess() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/config456"; + + // First set the task push notification config + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + assertNull(streamRecorder.getError()); + + // Then get the task push notification config + streamRecorder = getTaskPushNotificationConfigRequest(handler, NAME); + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertNotNull(result); + assertEquals(1, result.size()); + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig response = result.get(0); + assertEquals(NAME, response.getName()); + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig responseConfig = response.getPushNotificationConfig(); + assertEquals("config456", responseConfig.getId()); + assertEquals("http://example.com", responseConfig.getUrl()); + } + + @Test + public void testPushNotificationsNotSupportedError() throws Exception { + org.a2aproject.sdk.compat03.spec.AgentCard card = createAgentCard(true, false, false); + TestGrpcHandler handler = new TestGrpcHandler(card, convert03To10Handler, internalExecutor); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/" + MINIMAL_TASK.getId(); + StreamRecorder streamRecorder = + createTaskPushNotificationConfigRequest(handler, NAME); + + assertNotNull(streamRecorder.getError()); + assertInstanceOf(StatusRuntimeException.class, streamRecorder.getError()); + StatusRuntimeException error = (StatusRuntimeException) streamRecorder.getError(); + assertEquals(Status.Code.UNIMPLEMENTED, error.getStatus().getCode()); + } + + @Test + public void testDeletePushNotificationConfig() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + String NAME = "tasks/" + MINIMAL_TASK.getId() + "/pushNotificationConfigs/" + MINIMAL_TASK.getId(); + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.DeleteTaskPushNotificationConfigRequest.newBuilder() + .setName(NAME) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.deleteTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertEquals(1, result.size()); + } + + @Test + public void testListPushNotificationConfig() throws Exception { + TestGrpcHandler handler = new TestGrpcHandler(CARD, convert03To10Handler, internalExecutor); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + String PARENT = "tasks/" + MINIMAL_TASK.getId(); + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigRequest.newBuilder() + .setParent(PARENT) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.listTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + + assertNull(streamRecorder.getError()); + List result = streamRecorder.getValues(); + assertEquals(1, result.size()); + } + + // ======================================== + // Helper Methods + // ======================================== + + private StreamRecorder sendMessageRequest(TestGrpcHandler handler) throws Exception { + SendMessageRequest request = SendMessageRequest.newBuilder() + .setRequest(GRPC_MESSAGE) + .build(); + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.sendMessage(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private StreamRecorder sendStreamingMessageRequest(TestGrpcHandler handler) throws Exception { + SendMessageRequest request = SendMessageRequest.newBuilder() + .setRequest(GRPC_MESSAGE) + .build(); + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.sendStreamingMessage(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private void assertGrpcError(StreamRecorder streamRecorder, Status.Code expectedStatusCode) { + Assertions.assertNotNull(streamRecorder.getError()); + Assertions.assertInstanceOf(StatusRuntimeException.class, streamRecorder.getError()); + Assertions.assertEquals(expectedStatusCode, ((StatusRuntimeException) streamRecorder.getError()).getStatus().getCode()); + Assertions.assertTrue(streamRecorder.getValues().isEmpty()); + } + + + private StreamRecorder createTaskPushNotificationConfigRequest( + TestGrpcHandler handler, String name) throws Exception { + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig config = + org.a2aproject.sdk.compat03.grpc.PushNotificationConfig.newBuilder() + .setUrl("http://example.com") + .build(); + + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig taskPushNotificationConfig = + org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder() + .setName(name) + .setPushNotificationConfig(config) + .build(); + + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest setRequest = + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder() + .setConfig(taskPushNotificationConfig) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.createTaskPushNotificationConfig(setRequest, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + + private StreamRecorder getTaskPushNotificationConfigRequest( + TestGrpcHandler handler, String name) throws Exception { + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest request = + org.a2aproject.sdk.compat03.grpc.GetTaskPushNotificationConfigRequest.newBuilder() + .setName(name) + .build(); + + StreamRecorder streamRecorder = StreamRecorder.create(); + handler.getTaskPushNotificationConfig(request, streamRecorder); + streamRecorder.awaitCompletion(5, TimeUnit.SECONDS); + return streamRecorder; + } + // ======================================== + // Test Handler Implementation + // ======================================== + + private static class TestGrpcHandler extends GrpcHandler { + private final org.a2aproject.sdk.compat03.spec.AgentCard card; + private final org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler handler; + private final java.util.concurrent.Executor executor; + + TestGrpcHandler(org.a2aproject.sdk.compat03.spec.AgentCard card, + org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler handler, + java.util.concurrent.Executor executor) { + this.card = card; + this.handler = handler; + this.executor = executor; + setRequestHandler(handler); + } + + @Override + protected org.a2aproject.sdk.compat03.spec.AgentCard getAgentCard() { + return card; + } + + @Override + protected org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler getRequestHandler() { + return handler; + } + + @Override + protected CallContextFactory getCallContextFactory() { + return null; + } + + @Override + protected java.util.concurrent.Executor getExecutor() { + return executor; + } + } + +} diff --git a/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata.java b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata.java new file mode 100644 index 000000000..2d34dfcee --- /dev/null +++ b/compat-0.3/transport/grpc/src/test/java/org/a2aproject/sdk/compat03/transport/grpc/handler/GrpcTestTransportMetadata.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.transport.grpc.handler; + +// TODO: Uncomment when server-common is ported + +/** + * Placeholder stub - awaiting server-common port. + */ +public class GrpcTestTransportMetadata { +} diff --git a/compat-0.3/transport/jsonrpc/pom.xml b/compat-0.3/transport/jsonrpc/pom.xml new file mode 100644 index 000000000..4825ff369 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-jsonrpc + + jar + + Java SDK A2A Compat 0.3 Transport: JSONRPC + Java SDK for the Agent2Agent Protocol (A2A) - JSONRPC + + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + + + diff --git a/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys.java b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys.java new file mode 100644 index 000000000..a9c7f1690 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/context/JSONRPCContextKeys.java @@ -0,0 +1,24 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.context; + +/** + * Shared JSON-RPC context keys for A2A protocol data. + * + * These keys provide access to JSON-RPC context information, + * enabling rich context access in service method implementations. + */ +public final class JSONRPCContextKeys { + + /** + * Context key for storing the headers. + */ + public static final String HEADERS_KEY = "headers"; + + /** + * Context key for storing the method name being called. + */ + public static final String METHOD_NAME_KEY = "method"; + + private JSONRPCContextKeys() { + // Utility class + } +} diff --git a/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler.java b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler.java new file mode 100644 index 000000000..3a65cd540 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/main/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandler.java @@ -0,0 +1,280 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; + +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.Flow; + +import org.a2aproject.sdk.server.ExtendedAgentCard; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardRequest; +import org.a2aproject.sdk.compat03.spec.GetAuthenticatedExtendedCardResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageResponse; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter; +import org.a2aproject.sdk.spec.A2AError; +import mutiny.zero.ZeroPublisher; + +@ApplicationScoped +public class JSONRPCHandler { + + private AgentCard agentCard; + private Instance extendedAgentCard; + private Convert03To10RequestHandler requestHandler; + private final Executor executor; + + protected JSONRPCHandler() { + this.executor = null; + } + + @Inject + public JSONRPCHandler(@PublicAgentCard AgentCard agentCard, @ExtendedAgentCard Instance extendedAgentCard, + @Internal Executor executor, Convert03To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.extendedAgentCard = extendedAgentCard; + this.requestHandler = requestHandler; + this.executor = executor; + + // TODO: Port AgentCardValidator for v0.3 AgentCard or skip validation in compat layer + // AgentCardValidator.validateTransportConfiguration(agentCard); + } + + public JSONRPCHandler(@PublicAgentCard AgentCard agentCard, Executor executor, Convert03To10RequestHandler requestHandler) { + this(agentCard, null, executor, requestHandler); + } + + public SendMessageResponse onMessageSend(SendMessageRequest request, ServerCallContext context) { + try { + EventKind result = requestHandler.onMessageSend(request.getParams(), context); + return new SendMessageResponse(request.getId(), result); + } catch (A2AError e) { + return new SendMessageResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new SendMessageResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public Flow.Publisher onMessageSendStream( + SendStreamingMessageRequest request, ServerCallContext context) { + if (!agentCard.capabilities().streaming()) { + return ZeroPublisher.fromItems( + new SendStreamingMessageResponse( + request.getId(), + new InvalidRequestError("Streaming is not supported by the agent"))); + } + + try { + Flow.Publisher publisher = requestHandler.onMessageSendStream(request.getParams(), context); + return convertToSendStreamingMessageResponse(request.getId(), publisher); + } catch (A2AError e) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse(request.getId(), ErrorConverter.convertA2AError(e))); + } catch (Throwable t) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse(request.getId(), new InternalError(t.getMessage()))); + } + } + + public CancelTaskResponse onCancelTask(CancelTaskRequest request, ServerCallContext context) { + try { + Task result = requestHandler.onCancelTask(request.getParams(), context); + return new CancelTaskResponse(request.getId(), result); + } catch (A2AError e) { + return new CancelTaskResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new CancelTaskResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public Flow.Publisher onResubscribeToTask( + TaskResubscriptionRequest request, ServerCallContext context) { + if (!agentCard.capabilities().streaming()) { + return ZeroPublisher.fromItems( + new SendStreamingMessageResponse( + request.getId(), + new InvalidRequestError("Streaming is not supported by the agent"))); + } + + try { + Flow.Publisher publisher = requestHandler.onResubscribeToTask(request.getParams(), context); + return convertToSendStreamingMessageResponse(request.getId(), publisher); + } catch (A2AError e) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse(request.getId(), ErrorConverter.convertA2AError(e))); + } catch (Throwable t) { + return ZeroPublisher.fromItems(new SendStreamingMessageResponse(request.getId(), new InternalError(t.getMessage()))); + } + } + + public GetTaskPushNotificationConfigResponse getPushNotificationConfig( + GetTaskPushNotificationConfigRequest request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new GetTaskPushNotificationConfigResponse(request.getId(), + new PushNotificationNotSupportedError()); + } + try { + TaskPushNotificationConfig result = requestHandler.onGetTaskPushNotificationConfig(request.getParams(), context); + return new GetTaskPushNotificationConfigResponse(request.getId(), result); + } catch (A2AError e) { + return new GetTaskPushNotificationConfigResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new GetTaskPushNotificationConfigResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public SetTaskPushNotificationConfigResponse setPushNotificationConfig( + SetTaskPushNotificationConfigRequest request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new SetTaskPushNotificationConfigResponse(request.getId(), + new PushNotificationNotSupportedError()); + } + try { + TaskPushNotificationConfig result = requestHandler.onSetTaskPushNotificationConfig(request.getParams(), context); + return new SetTaskPushNotificationConfigResponse(request.getId(), result); + } catch (A2AError e) { + return new SetTaskPushNotificationConfigResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new SetTaskPushNotificationConfigResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public GetTaskResponse onGetTask(GetTaskRequest request, ServerCallContext context) { + try { + Task result = requestHandler.onGetTask(request.getParams(), context); + return new GetTaskResponse(request.getId(), result); + } catch (A2AError e) { + return new GetTaskResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new GetTaskResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public ListTaskPushNotificationConfigResponse listPushNotificationConfig( + ListTaskPushNotificationConfigRequest request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new ListTaskPushNotificationConfigResponse(request.getId(), + new PushNotificationNotSupportedError()); + } + try { + List pushNotificationConfigList = + requestHandler.onListTaskPushNotificationConfig(request.getParams(), context); + return new ListTaskPushNotificationConfigResponse(request.getId(), pushNotificationConfigList); + } catch (A2AError e) { + return new ListTaskPushNotificationConfigResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new ListTaskPushNotificationConfigResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public DeleteTaskPushNotificationConfigResponse deletePushNotificationConfig( + DeleteTaskPushNotificationConfigRequest request, ServerCallContext context) { + if (!agentCard.capabilities().pushNotifications()) { + return new DeleteTaskPushNotificationConfigResponse(request.getId(), + new PushNotificationNotSupportedError()); + } + try { + requestHandler.onDeleteTaskPushNotificationConfig(request.getParams(), context); + return new DeleteTaskPushNotificationConfigResponse(request.getId()); + } catch (A2AError e) { + return new DeleteTaskPushNotificationConfigResponse(request.getId(), ErrorConverter.convertA2AError(e)); + } catch (Throwable t) { + return new DeleteTaskPushNotificationConfigResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + // TODO: Add authentication (https://github.com/a2aproject/a2a-java/issues/77) + public GetAuthenticatedExtendedCardResponse onGetAuthenticatedExtendedCardRequest( + GetAuthenticatedExtendedCardRequest request, ServerCallContext context) { + if (!agentCard.supportsAuthenticatedExtendedCard() || !extendedAgentCard.isResolvable()) { + return new GetAuthenticatedExtendedCardResponse(request.getId(), + new AuthenticatedExtendedCardNotConfiguredError(null, "Authenticated Extended Card not configured", null)); + } + try { + return new GetAuthenticatedExtendedCardResponse(request.getId(), extendedAgentCard.get()); + } catch (JSONRPCError e) { + return new GetAuthenticatedExtendedCardResponse(request.getId(), e); + } catch (Throwable t) { + return new GetAuthenticatedExtendedCardResponse(request.getId(), new InternalError(t.getMessage())); + } + } + + public AgentCard getAgentCard() { + return agentCard; + } + + private Flow.Publisher convertToSendStreamingMessageResponse( + Object requestId, + Flow.Publisher publisher) { + // We can't use the normal convertingProcessor since that propagates any errors as an error handled + // via Subscriber.onError() rather than as part of the SendStreamingResponse payload + return ZeroPublisher.create(createTubeConfig(), tube -> { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind item) { + tube.send(new SendStreamingMessageResponse(requestId, item)); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof JSONRPCError jsonrpcError) { + tube.send(new SendStreamingMessageResponse(requestId, jsonrpcError)); + } else { + tube.send( + new SendStreamingMessageResponse( + requestId, new + InternalError(throwable.getMessage()))); + } + onComplete(); + } + + @Override + public void onComplete() { + tube.complete(); + } + }); + }, executor); + }); + } +} diff --git a/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandlerTest.java b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandlerTest.java new file mode 100644 index 000000000..cba4d20f6 --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCHandlerTest.java @@ -0,0 +1,1136 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.Flow; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskArtifactUpdateEventMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskStatusUpdateEventMapper; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +// V0.3 spec imports (client perspective) +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.Artifact; +import org.a2aproject.sdk.compat03.spec.CancelTaskRequest; +import org.a2aproject.sdk.compat03.spec.CancelTaskResponse; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.GetTaskRequest; +import org.a2aproject.sdk.compat03.spec.GetTaskResponse; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.Message; +import org.a2aproject.sdk.compat03.spec.MessageSendParams; +import org.a2aproject.sdk.compat03.spec.PushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.SendMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendMessageResponse; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigRequest; +import org.a2aproject.sdk.compat03.spec.SetTaskPushNotificationConfigResponse; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageRequest; +import org.a2aproject.sdk.compat03.spec.SendStreamingMessageResponse; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskArtifactUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.TaskResubscriptionRequest; +import org.a2aproject.sdk.compat03.spec.TaskState; +import org.a2aproject.sdk.compat03.spec.TaskStatus; +import org.a2aproject.sdk.compat03.spec.TaskStatusUpdateEvent; +import org.a2aproject.sdk.compat03.spec.TextPart; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; + +/** + * Test suite for v0.3 JSONRPCHandler with v1.0 backend. + *

+ * Tests verify that v0.3 clients can successfully communicate with the v1.0 backend + * via the {@link org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler} conversion layer. + *

+ *

+ * Phase 2 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests and push notification tests are deferred to later phases. + *

+ */ +public class JSONRPCHandlerTest extends AbstractA2ARequestHandlerTest { + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testOnGetTaskSuccess() throws Exception { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 for taskStore + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + GetTaskRequest request = new GetTaskRequest("1", new TaskQueryParams(MINIMAL_TASK.getId())); + GetTaskResponse response = handler.onGetTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getError()); + + // Response should contain v0.3 task (converted back from v1.0) + Task result = response.getResult(); + assertEquals(MINIMAL_TASK.getId(), result.getId()); + assertEquals(MINIMAL_TASK.getContextId(), result.getContextId()); + } + + @Test + public void testOnGetTaskNotFound() throws Exception { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + GetTaskRequest request = new GetTaskRequest("1", new TaskQueryParams(MINIMAL_TASK.getId())); + GetTaskResponse response = handler.onGetTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertInstanceOf(TaskNotFoundError.class, response.getError()); + assertNull(response.getResult()); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testOnCancelTaskSuccess() throws Exception { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + // In v1.0, we use AgentEmitter.cancel() instead of TaskUpdater + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + CancelTaskRequest request = new CancelTaskRequest("111", new TaskIdParams(MINIMAL_TASK.getId())); + CancelTaskResponse response = handler.onCancelTask(request, callContext); + + assertNull(response.getError()); + assertEquals(request.getId(), response.getId()); + + // Verify task was canceled + Task task = response.getResult(); + assertEquals(MINIMAL_TASK.getId(), task.getId()); + assertEquals(MINIMAL_TASK.getContextId(), task.getContextId()); + assertEquals(TaskState.CANCELED, task.getStatus().state()); + } + + @Test + public void testOnCancelTaskNotSupported() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to throw UnsupportedOperationError + agentExecutorCancel = (context, emitter) -> { + throw new org.a2aproject.sdk.spec.UnsupportedOperationError(); + }; + + CancelTaskRequest request = new CancelTaskRequest("1", new TaskIdParams(MINIMAL_TASK.getId())); + CancelTaskResponse response = handler.onCancelTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getResult()); + assertInstanceOf(UnsupportedOperationError.class, response.getError()); + } + + @Test + public void testOnCancelTaskNotFound() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + CancelTaskRequest request = new CancelTaskRequest("1", new TaskIdParams(MINIMAL_TASK.getId())); + CancelTaskResponse response = handler.onCancelTask(request, callContext); + + assertEquals(request.getId(), response.getId()); + assertNull(response.getResult()); + assertInstanceOf(TaskNotFoundError.class, response.getError()); + } + + // ======================================== + // SendMessage Tests (Non-Streaming) + // ======================================== + + @Test + public void testOnMessageSendSuccess() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + // Note: context.getMessage() contains v1.0 Message (already converted by Convert03To10RequestHandler) + // Emit the v1.0 message, it will be converted back to v0.3 in the response + emitter.emitEvent(context.getMessage()); + }; + + Message message = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest request = new SendMessageRequest("1", new MessageSendParams(message, null, null)); + SendMessageResponse response = handler.onMessageSend(request, callContext); + + assertNull(response.getError()); + // Response should contain the message (converted back from v1.0) + org.a2aproject.sdk.compat03.spec.EventKind result = response.getResult(); + if (result instanceof Message) { + assertEquals(message.getMessageId(), ((Message) result).getMessageId()); + } + } + + @Test + public void testOnMessageSendWithExistingTaskSuccess() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit message + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 message from context + emitter.emitEvent(context.getMessage()); + }; + + Message message = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest request = new SendMessageRequest("1", new MessageSendParams(message, null, null)); + SendMessageResponse response = handler.onMessageSend(request, callContext); + + assertNull(response.getError()); + org.a2aproject.sdk.compat03.spec.EventKind result = response.getResult(); + if (result instanceof Message) { + assertEquals(message.getMessageId(), ((Message) result).getMessageId()); + } + } + + @Test + public void testOnMessageSendError() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to throw error + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(new org.a2aproject.sdk.spec.UnsupportedOperationError()); + }; + + Message message = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendMessageRequest request = new SendMessageRequest("1", new MessageSendParams(message, null, null)); + SendMessageResponse response = handler.onMessageSend(request, callContext); + + assertInstanceOf(UnsupportedOperationError.class, response.getError()); + assertNull(response.getResult()); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testOnMessageSendStreamSuccess() throws InterruptedException { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to emit the message back (v1.0 context contains v1.0 Message) + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 message - will be converted to v0.3 StreamingEventKind + emitter.emitEvent(context.getMessage()); + }; + + Message message = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendStreamingMessageRequest request = new SendStreamingMessageRequest( + "1", new MessageSendParams(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + CountDownLatch latch = new CountDownLatch(1); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item.getResult()); + subscription.request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Wait for event to be received + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 1 event within timeout"); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify that the message was received + assertEquals(1, results.size(), "Should have received exactly 1 event"); + + // Verify the event is the message (converted back from v1.0) + Message receivedMessage = assertInstanceOf(Message.class, results.get(0), "Event should be a Message"); + assertEquals(message.getMessageId(), receivedMessage.getMessageId()); + } + + @Test + public void testOnMessageSendStreamMultipleEventsSuccess() throws InterruptedException { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Create v0.3 events for reference (we'll emit v1.0 equivalents) + Task v03TaskEvent = new Task.Builder(MINIMAL_TASK) + .status(new TaskStatus(TaskState.WORKING)) + .build(); + + TaskArtifactUpdateEvent v03ArtifactEvent = new TaskArtifactUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact.Builder() + .artifactId("artifact-1") + .parts(new TextPart("Generated artifact content")) + .build()) + .build(); + + TaskStatusUpdateEvent v03StatusEvent = new TaskStatusUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus(TaskState.COMPLETED)) + .isFinal(true) // Must be true for COMPLETED state in v1.0 + .build(); + + // Configure the agent executor to emit multiple v1.0 events + agentExecutorExecute = (context, emitter) -> { + // Convert v0.3 events to v1.0 and emit them + // The emitter will convert them back to v0.3 StreamingEventKind for the response + emitter.emitEvent(TaskMapper.INSTANCE.toV10(v03TaskEvent)); + emitter.emitEvent(TaskArtifactUpdateEventMapper.INSTANCE.toV10(v03ArtifactEvent)); + emitter.emitEvent(TaskStatusUpdateEventMapper.INSTANCE.toV10(v03StatusEvent)); + }; + + Message message = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .build(); + + SendStreamingMessageRequest request = new SendStreamingMessageRequest( + "1", new MessageSendParams(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + CountDownLatch latch = new CountDownLatch(3); // Expect 3 events + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item.getResult()); + subscription.request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Wait for all events to be received + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 3 events within timeout"); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify that all 3 events were received + assertEquals(3, results.size(), "Should have received exactly 3 events"); + + // Verify the first event is the task + Task receivedTask = assertInstanceOf(Task.class, results.get(0), "First event should be a Task"); + assertEquals(MINIMAL_TASK.getId(), receivedTask.getId()); + assertEquals(MINIMAL_TASK.getContextId(), receivedTask.getContextId()); + assertEquals(TaskState.WORKING, receivedTask.getStatus().state()); + + // Verify the second event is the artifact update + TaskArtifactUpdateEvent receivedArtifact = assertInstanceOf(TaskArtifactUpdateEvent.class, results.get(1), + "Second event should be a TaskArtifactUpdateEvent"); + assertEquals(MINIMAL_TASK.getId(), receivedArtifact.getTaskId()); + assertEquals("artifact-1", receivedArtifact.getArtifact().artifactId()); + + // Verify the third event is the status update + TaskStatusUpdateEvent receivedStatus = assertInstanceOf(TaskStatusUpdateEvent.class, results.get(2), + "Third event should be a TaskStatusUpdateEvent"); + assertEquals(MINIMAL_TASK.getId(), receivedStatus.getTaskId()); + assertEquals(TaskState.COMPLETED, receivedStatus.getStatus().state()); + } + + @Test + public void testOnMessageSendStreamExistingTaskSuccess() throws InterruptedException { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to emit the task (v1.0 context contains v1.0 Task) + agentExecutorExecute = (context, emitter) -> { + // Emit v1.0 task - will be converted to v0.3 StreamingEventKind + emitter.emitEvent(context.getTask()); + }; + + // Save existing v0.3 task (convert to v1.0 for storage) + Task v03Task = new Task.Builder(MINIMAL_TASK) + .history(new ArrayList<>()) + .build(); + taskStore.save(TaskMapper.INSTANCE.toV10(v03Task), false); + + Message message = new Message.Builder(MESSAGE) + .taskId(v03Task.getId()) + .contextId(v03Task.getContextId()) + .build(); + + SendStreamingMessageRequest request = new SendStreamingMessageRequest( + "1", new MessageSendParams(message, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + // For non-final tasks, the publisher doesn't complete, so we subscribe in a new thread + // and manually cancel after receiving the first event + final List results = new ArrayList<>(); + final AtomicReference subscriptionRef = new AtomicReference<>(); + final CountDownLatch latch = new CountDownLatch(1); + final AtomicReference error = new AtomicReference<>(); + + Executors.newSingleThreadExecutor().execute(() -> { + response.subscribe(new Flow.Subscriber<>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriptionRef.set(subscription); + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item.getResult()); + subscriptionRef.get().request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscriptionRef.get().cancel(); + // Release latch to prevent timeout + while (latch.getCount() > 0) { + latch.countDown(); + } + } + + @Override + public void onComplete() { + subscriptionRef.get().cancel(); + } + }); + }); + + // Wait for the first event + assertTrue(latch.await(2, TimeUnit.SECONDS), "Expected to receive 1 event within timeout"); + subscriptionRef.get().cancel(); + + // Assert no error occurred during streaming + assertNull(error.get(), "No error should occur during streaming"); + + // Verify the task was received + assertEquals(1, results.size(), "Should have received exactly 1 event"); + Task receivedTask = assertInstanceOf(Task.class, results.get(0), "Event should be a Task"); + assertEquals(v03Task.getId(), receivedTask.getId()); + assertEquals(v03Task.getContextId(), receivedTask.getContextId()); + // Note: v1.0 backend manages task history differently than v0.3 + // The key assertion is that we received a Task event for the existing task + } + + // ======================================== + // Streaming Error Tests + // ======================================== + + @Test + public void testStreamingNotSupportedError() { + // Create agent card with streaming disabled + AgentCard nonStreamingCard = new AgentCard.Builder(CARD) + .capabilities(new AgentCapabilities(false, true, false, null)) + .build(); + + JSONRPCHandler handler = new JSONRPCHandler(nonStreamingCard, internalExecutor, convert03To10Handler); + + SendStreamingMessageRequest request = new SendStreamingMessageRequest( + "1", new MessageSendParams(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an error response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse errorResponse = results.get(0); + assertNotNull(errorResponse.getError(), "Response should contain an error"); + assertInstanceOf(InvalidRequestError.class, errorResponse.getError(), "Error should be InvalidRequestError"); + assertEquals("Streaming is not supported by the agent", + ((InvalidRequestError) errorResponse.getError()).getMessage()); + } + + @Test + public void testOnMessageStreamTaskIdMismatch() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save existing task + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to emit a task with DIFFERENT task ID than the message + agentExecutorExecute = (context, emitter) -> { + // Emit MINIMAL_TASK (which has different ID from MESSAGE) + emitter.emitEvent(context.getTask()); + }; + + // Send MESSAGE (which has a different task ID) + SendStreamingMessageRequest request = new SendStreamingMessageRequest( + "1", new MessageSendParams(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + CompletableFuture future = new CompletableFuture<>(); + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + future.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + subscription.cancel(); + future.complete(null); + } + }); + + future.join(); + + // Stream should complete without throwing + assertNull(error.get(), "No exception should be thrown"); + + // Should receive an error response for the task ID mismatch + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse errorResponse = results.get(0); + assertInstanceOf(InternalError.class, errorResponse.getError(), + "Task ID mismatch should result in InternalError"); + } + + @Test + public void testOnMessageStreamInternalError() { + // Mock the Convert03To10RequestHandler to throw InternalError + Convert03To10RequestHandler mockedHandler = Mockito.mock(Convert03To10RequestHandler.class); + Mockito.doThrow(new org.a2aproject.sdk.spec.InternalError("Internal Error")) + .when(mockedHandler) + .onMessageSendStream( + Mockito.any(org.a2aproject.sdk.compat03.spec.MessageSendParams.class), + Mockito.any(ServerCallContext.class)); + + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, mockedHandler); + + SendStreamingMessageRequest request = new SendStreamingMessageRequest("1", new MessageSendParams(MESSAGE, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an InternalError response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + assertInstanceOf(InternalError.class, results.get(0).getError(), "Error should be InternalError"); + } + + @Test + public void testStreamingNotSupportedErrorOnResubscribeToTask() { + // Create agent card with streaming disabled + AgentCard nonStreamingCard = new AgentCard.Builder(CARD) + .capabilities(new AgentCapabilities(false, true, false, null)) + .build(); + + JSONRPCHandler handler = new JSONRPCHandler(nonStreamingCard, internalExecutor, convert03To10Handler); + + TaskResubscriptionRequest request = new TaskResubscriptionRequest("1", new TaskIdParams(MINIMAL_TASK.getId())); + Flow.Publisher response = handler.onResubscribeToTask(request, callContext); + + List results = new ArrayList<>(); + AtomicReference error = new AtomicReference<>(); + + response.subscribe(new Flow.Subscriber<>() { + private Flow.Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item); + subscription.request(1); + } + + @Override + public void onError(Throwable throwable) { + error.set(throwable); + subscription.cancel(); + } + + @Override + public void onComplete() { + subscription.cancel(); + } + }); + + // Verify that an error response was returned + assertEquals(1, results.size(), "Should receive exactly one error response"); + SendStreamingMessageResponse errorResponse = results.get(0); + assertNotNull(errorResponse.getError(), "Response should contain an error"); + assertInstanceOf(InvalidRequestError.class, errorResponse.getError(), "Error should be InvalidRequestError"); + assertEquals("Streaming is not supported by the agent", + ((InvalidRequestError) errorResponse.getError()).getMessage()); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testSetPushNotificationConfigSuccess() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend (conversion happens internally) + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + TaskPushNotificationConfig taskPushConfig = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .build()); + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest("1", taskPushConfig); + SetTaskPushNotificationConfigResponse response = handler.setPushNotificationConfig(request, callContext); + + assertNull(response.getError(), "Error: " + response.getError()); + assertNotNull(response.getResult()); + + TaskPushNotificationConfig taskPushConfigResult = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + assertEquals(taskPushConfigResult, response.getResult()); + } + + @Test + public void testGetPushNotificationConfigSuccess() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig taskPushConfig = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .build()); + + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + GetTaskPushNotificationConfigRequest getRequest = + new GetTaskPushNotificationConfigRequest("111", new GetTaskPushNotificationConfigParams(MINIMAL_TASK.getId())); + GetTaskPushNotificationConfigResponse getResponse = handler.getPushNotificationConfig(getRequest, callContext); + + TaskPushNotificationConfig expectedConfig = new TaskPushNotificationConfig(MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder().id(MINIMAL_TASK.getId()).url("http://example.com").build()); + assertEquals(expectedConfig, getResponse.getResult()); + } + + @Test + public void testDeletePushNotificationConfig() { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig taskPushConfig = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest deleteRequest = + new DeleteTaskPushNotificationConfigRequest("111", new DeleteTaskPushNotificationConfigParams(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getError()); + assertNull(deleteResponse.getResult()); + } + + @Test + public void testOnGetPushNotificationNoPushNotifierConfig() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert03To10RequestHandler handlerWithoutPushConfig = new Convert03To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + AgentCard card = createAgentCard(false, true, false); + JSONRPCHandler handler = new JSONRPCHandler(card, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + GetTaskPushNotificationConfigRequest request = + new GetTaskPushNotificationConfigRequest("id", new GetTaskPushNotificationConfigParams(MINIMAL_TASK.getId())); + GetTaskPushNotificationConfigResponse response = handler.getPushNotificationConfig(request, callContext); + + assertNotNull(response.getError()); + assertInstanceOf(UnsupportedOperationError.class, response.getError()); + assertEquals("This operation is not supported", response.getError().getMessage()); + } + + @Test + public void testOnSetPushNotificationNoPushNotifierConfig() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert03To10RequestHandler handlerWithoutPushConfig = new Convert03To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + AgentCard card = createAgentCard(false, true, false); + JSONRPCHandler handler = new JSONRPCHandler(card, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + TaskPushNotificationConfig config = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .build()); + + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest.Builder() + .params(config) + .build(); + SetTaskPushNotificationConfigResponse response = handler.setPushNotificationConfig(request, callContext); + + assertInstanceOf(UnsupportedOperationError.class, response.getError()); + assertEquals("This operation is not supported", response.getError().getMessage()); + } + + @Test + public void testDeletePushNotificationConfigNotSupported() { + AgentCard card = createAgentCard(true, false, false); + JSONRPCHandler handler = new JSONRPCHandler(card, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig taskPushConfig = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest deleteRequest = + new DeleteTaskPushNotificationConfigRequest("111", new DeleteTaskPushNotificationConfigParams(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getResult()); + assertInstanceOf(PushNotificationNotSupportedError.class, deleteResponse.getError()); + } + + @Test + public void testDeletePushNotificationConfigNoPushConfigStore() { + // Create v1.0 request handler without push config store + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler v10Handler = + org.a2aproject.sdk.server.requesthandlers.DefaultRequestHandler.create( + agentExecutor, taskStore, queueManager, null, mainEventBusProcessor, + internalExecutor, internalExecutor); + + // Wrap in v0.3 conversion handler + Convert03To10RequestHandler handlerWithoutPushConfig = new Convert03To10RequestHandler(); + handlerWithoutPushConfig.v10Handler = v10Handler; + + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, handlerWithoutPushConfig); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + agentExecutorExecute = (context, agentEmitter) -> { + agentEmitter.emitEvent(context.getTask() != null ? context.getTask() : context.getMessage()); + }; + + TaskPushNotificationConfig taskPushConfig = + new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder() + .url("http://example.com") + .id(MINIMAL_TASK.getId()) + .build()); + SetTaskPushNotificationConfigRequest request = new SetTaskPushNotificationConfigRequest("1", taskPushConfig); + handler.setPushNotificationConfig(request, callContext); + + DeleteTaskPushNotificationConfigRequest deleteRequest = + new DeleteTaskPushNotificationConfigRequest("111", new DeleteTaskPushNotificationConfigParams(MINIMAL_TASK.getId(), MINIMAL_TASK.getId())); + DeleteTaskPushNotificationConfigResponse deleteResponse = + handler.deletePushNotificationConfig(deleteRequest, callContext); + + assertEquals("111", deleteResponse.getId()); + assertNull(deleteResponse.getResult()); + assertInstanceOf(UnsupportedOperationError.class, deleteResponse.getError()); + } + + @Test + public void testOnMessageStreamNewMessageSendPushNotificationSuccess() throws Exception { + // Use synchronous executor for push notifications to ensure deterministic ordering + // Without this, async push notifications can execute out of order, causing test flakiness + mainEventBusProcessor.setPushNotificationExecutor(Runnable::run); + + try { + JSONRPCHandler handler = new JSONRPCHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + org.a2aproject.sdk.spec.Task v10Task = TaskMapper.INSTANCE.toV10(MINIMAL_TASK); + taskStore.save(v10Task, false); + + // Clear any previous events from httpClient + httpClient.events.clear(); + + // Create v0.3 events that the agent executor will emit + List events = List.of( + MINIMAL_TASK, + new TaskArtifactUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .artifact(new Artifact.Builder() + .artifactId("11") + .parts(new TextPart("text")) + .build()) + .build(), + new TaskStatusUpdateEvent.Builder() + .taskId(MINIMAL_TASK.getId()) + .contextId(MINIMAL_TASK.getContextId()) + .status(new TaskStatus(TaskState.COMPLETED)) + .isFinal(true) + .build()); + + agentExecutorExecute = (context, agentEmitter) -> { + // Convert v0.3 events to v1.0 and emit + for (org.a2aproject.sdk.compat03.spec.Event event : events) { + if (event instanceof Task) { + agentEmitter.emitEvent(TaskMapper.INSTANCE.toV10((Task) event)); + } else if (event instanceof TaskArtifactUpdateEvent) { + agentEmitter.emitEvent(TaskArtifactUpdateEventMapper.INSTANCE.toV10((TaskArtifactUpdateEvent) event)); + } else if (event instanceof TaskStatusUpdateEvent) { + agentEmitter.emitEvent(TaskStatusUpdateEventMapper.INSTANCE.toV10((TaskStatusUpdateEvent) event)); + } + } + }; + + // Set push notification config + TaskPushNotificationConfig config = new TaskPushNotificationConfig( + MINIMAL_TASK.getId(), + new PushNotificationConfig.Builder().url("http://example.com").build()); + SetTaskPushNotificationConfigRequest stpnRequest = new SetTaskPushNotificationConfigRequest("1", config); + SetTaskPushNotificationConfigResponse stpnResponse = handler.setPushNotificationConfig(stpnRequest, callContext); + assertNull(stpnResponse.getError()); + + // Send streaming message + Message msg = new Message.Builder(MESSAGE) + .taskId(MINIMAL_TASK.getId()) + .build(); + SendStreamingMessageRequest request = new SendStreamingMessageRequest("1", new MessageSendParams(msg, null, null)); + Flow.Publisher response = handler.onMessageSendStream(request, callContext); + + final List results = Collections.synchronizedList(new ArrayList<>()); + final AtomicReference subscriptionRef = new AtomicReference<>(); + final CountDownLatch latch = new CountDownLatch(6); // 3 streaming responses + 3 push notifications + httpClient.latch = latch; + + Executors.newSingleThreadExecutor().execute(() -> { + response.subscribe(new Flow.Subscriber<>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + subscriptionRef.set(subscription); + subscription.request(1); + } + + @Override + public void onNext(SendStreamingMessageResponse item) { + results.add(item.getResult()); + subscriptionRef.get().request(1); + latch.countDown(); + } + + @Override + public void onError(Throwable throwable) { + subscriptionRef.get().cancel(); + } + + @Override + public void onComplete() { + subscriptionRef.get().cancel(); + } + }); + }); + + boolean timedOut = !latch.await(5, TimeUnit.SECONDS); + if (timedOut) { + System.out.println("Test timed out! Received " + results.size() + " streaming responses, " + + httpClient.events.size() + " push notifications. Latch count: " + latch.getCount()); + System.out.println("Push notifications received:"); + for (int i = 0; i < httpClient.events.size(); i++) { + org.a2aproject.sdk.spec.StreamingEventKind event = httpClient.events.get(i); + if (event instanceof org.a2aproject.sdk.spec.Task) { + System.out.println(" [" + i + "] Task"); + } else if (event instanceof org.a2aproject.sdk.spec.TaskArtifactUpdateEvent) { + System.out.println(" [" + i + "] TaskArtifactUpdateEvent"); + } else if (event instanceof org.a2aproject.sdk.spec.TaskStatusUpdateEvent) { + System.out.println(" [" + i + "] TaskStatusUpdateEvent"); + } else if (event instanceof org.a2aproject.sdk.spec.Message) { + System.out.println(" [" + i + "] Message"); + } + } + } + assertTrue(!timedOut, "Test timed out waiting for events. Received " + results.size() + " streaming responses, " + + httpClient.events.size() + " push notifications"); + subscriptionRef.get().cancel(); + + // Verify streaming responses (v0.3 format) + assertEquals(3, results.size()); + + // Verify push notifications were sent (v1.0 StreamingEventKind format) + assertEquals(3, httpClient.events.size()); + + // First event: task + org.a2aproject.sdk.spec.StreamingEventKind pushEvent0 = httpClient.events.get(0); + assertTrue(pushEvent0 instanceof org.a2aproject.sdk.spec.Task); + org.a2aproject.sdk.spec.Task v10PushedTask0 = (org.a2aproject.sdk.spec.Task) pushEvent0; + assertEquals(MINIMAL_TASK.getId(), v10PushedTask0.id()); + assertEquals(MINIMAL_TASK.getContextId(), v10PushedTask0.contextId()); + // v0.3 SUBMITTED maps to v1.0 TASK_STATE_SUBMITTED + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_SUBMITTED, v10PushedTask0.status().state()); + assertTrue(v10PushedTask0.artifacts() == null || v10PushedTask0.artifacts().isEmpty()); + + // Second event: artifact update + org.a2aproject.sdk.spec.StreamingEventKind pushEvent1 = httpClient.events.get(1); + assertTrue(pushEvent1 instanceof org.a2aproject.sdk.spec.TaskArtifactUpdateEvent); + org.a2aproject.sdk.spec.TaskArtifactUpdateEvent v10ArtifactUpdate = (org.a2aproject.sdk.spec.TaskArtifactUpdateEvent) pushEvent1; + assertEquals(MINIMAL_TASK.getId(), v10ArtifactUpdate.taskId()); + assertEquals(MINIMAL_TASK.getContextId(), v10ArtifactUpdate.contextId()); + assertNotNull(v10ArtifactUpdate.artifact()); + assertEquals(1, v10ArtifactUpdate.artifact().parts().size()); + assertEquals("text", ((org.a2aproject.sdk.spec.TextPart) v10ArtifactUpdate.artifact().parts().get(0)).text()); + + // Third event: status update + org.a2aproject.sdk.spec.StreamingEventKind pushEvent2 = httpClient.events.get(2); + assertTrue(pushEvent2 instanceof org.a2aproject.sdk.spec.TaskStatusUpdateEvent); + org.a2aproject.sdk.spec.TaskStatusUpdateEvent v10StatusUpdate = (org.a2aproject.sdk.spec.TaskStatusUpdateEvent) pushEvent2; + assertEquals(MINIMAL_TASK.getId(), v10StatusUpdate.taskId()); + assertEquals(MINIMAL_TASK.getContextId(), v10StatusUpdate.contextId()); + assertEquals(org.a2aproject.sdk.spec.TaskState.TASK_STATE_COMPLETED, v10StatusUpdate.status().state()); + } finally { + // Reset push notification executor to async + mainEventBusProcessor.setPushNotificationExecutor(null); + } + } + + // TODO Phase 6: Add authenticated extended card tests +} diff --git a/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata.java b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata.java new file mode 100644 index 000000000..8816462ba --- /dev/null +++ b/compat-0.3/transport/jsonrpc/src/test/java/org/a2aproject/sdk/compat03/transport/jsonrpc/handler/JSONRPCTestTransportMetadata.java @@ -0,0 +1,19 @@ +package org.a2aproject.sdk.compat03.transport.jsonrpc.handler; + +// TODO: Uncomment when server-common is ported + +// import org.a2aproject.sdk.compat03.server.TransportMetadata; +// import org.a2aproject.sdk.compat03.spec.TransportProtocol; + +// public class JSONRPCTestTransportMetadata implements TransportMetadata { +// @Override +// public String getTransportProtocol() { +// return TransportProtocol.JSONRPC.asString(); +// } +// } + +/** + * Placeholder stub - awaiting server-common port. + */ +public class JSONRPCTestTransportMetadata { +} diff --git a/compat-0.3/transport/rest/pom.xml b/compat-0.3/transport/rest/pom.xml new file mode 100644 index 000000000..3555667cc --- /dev/null +++ b/compat-0.3/transport/rest/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + + org.a2aproject.sdk + a2a-java-sdk-compat-0.3-parent + 1.0.0.Beta1-SNAPSHOT + ../.. + + a2a-java-sdk-compat-0.3-transport-rest + + jar + + Java SDK A2A Compat 0.3 Transport: JSON+HTTP/REST + Java SDK for the Agent2Agent Protocol (A2A) - JSON+HTTP/REST Transport + + + + ${project.groupId} + a2a-java-sdk-server-common + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec-grpc + + + ${project.groupId} + a2a-java-sdk-compat-0.3-spec + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + + + ${project.groupId} + a2a-java-sdk-server-common + test-jar + test + + + ${project.groupId} + a2a-java-sdk-compat-0.3-server-conversion + ${project.version} + test-jar + test + + + ch.qos.logback + logback-classic + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.mockito + mockito-core + test + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.google.protobuf + protobuf-java-util + + + org.slf4j + slf4j-jdk14 + test + + + + + \ No newline at end of file diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys.java new file mode 100644 index 000000000..2446f91a2 --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/context/RestContextKeys.java @@ -0,0 +1,24 @@ +package org.a2aproject.sdk.compat03.transport.rest.context; + +/** + * Shared REST context keys for A2A protocol data. + * + * These keys provide access to REST context information, + * enabling rich context access in service method implementations. + */ +public final class RestContextKeys { + + /** + * Context key for storing the headers. + */ + public static final String HEADERS_KEY = "headers"; + + /** + * Context key for storing the method name being called. + */ + public static final String METHOD_NAME_KEY = "method"; + + private RestContextKeys() { + // Utility class + } +} diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler.java new file mode 100644 index 000000000..72021614e --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandler.java @@ -0,0 +1,451 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import static org.a2aproject.sdk.server.util.async.AsyncUtils.createTubeConfig; + +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.protobuf.util.JsonFormat; +import org.a2aproject.sdk.compat03.grpc.utils.ProtoUtils; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import java.util.List; +import java.util.concurrent.Flow; + +import org.a2aproject.sdk.server.ExtendedAgentCard; +import org.a2aproject.sdk.server.PublicAgentCard; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.compat03.spec.AuthenticatedExtendedCardNotConfiguredError; +import org.a2aproject.sdk.compat03.spec.ContentTypeNotSupportedError; +import org.a2aproject.sdk.compat03.spec.DeleteTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.EventKind; +import org.a2aproject.sdk.compat03.spec.GetTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.InternalError; +import org.a2aproject.sdk.compat03.spec.InvalidAgentResponseError; +import org.a2aproject.sdk.compat03.spec.InvalidParamsError; +import org.a2aproject.sdk.compat03.spec.InvalidRequestError; +import org.a2aproject.sdk.compat03.spec.JSONParseError; +import org.a2aproject.sdk.compat03.spec.JSONRPCError; +import org.a2aproject.sdk.compat03.spec.ListTaskPushNotificationConfigParams; +import org.a2aproject.sdk.compat03.spec.MethodNotFoundError; +import org.a2aproject.sdk.compat03.spec.PushNotificationNotSupportedError; +import org.a2aproject.sdk.compat03.spec.StreamingEventKind; +import org.a2aproject.sdk.compat03.spec.Task; +import org.a2aproject.sdk.compat03.spec.TaskIdParams; +import org.a2aproject.sdk.compat03.spec.TaskNotCancelableError; +import org.a2aproject.sdk.compat03.spec.TaskNotFoundError; +import org.a2aproject.sdk.compat03.spec.TaskPushNotificationConfig; +import org.a2aproject.sdk.compat03.spec.TaskQueryParams; +import org.a2aproject.sdk.compat03.spec.UnsupportedOperationError; +import org.a2aproject.sdk.server.util.async.Internal; +import org.a2aproject.sdk.compat03.json.JsonUtil; +import org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler; +import org.a2aproject.sdk.compat03.conversion.ErrorConverter; +import org.a2aproject.sdk.spec.A2AError; +import jakarta.enterprise.inject.Instance; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.logging.Level; +import java.util.logging.Logger; +import mutiny.zero.ZeroPublisher; +import org.jspecify.annotations.Nullable; + +@ApplicationScoped +public class RestHandler { + + private static final Logger log = Logger.getLogger(RestHandler.class.getName()); + private AgentCard agentCard; + private @Nullable + Instance extendedAgentCard; + private Convert03To10RequestHandler requestHandler; + private final Executor executor; + + @SuppressWarnings("NullAway") + protected RestHandler() { + // For CDI + this.executor = null; + } + + @Inject + public RestHandler(@PublicAgentCard AgentCard agentCard, @ExtendedAgentCard Instance extendedAgentCard, + @Internal Executor executor, Convert03To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.extendedAgentCard = extendedAgentCard; + this.requestHandler = requestHandler; + this.executor = executor; + + // TODO: Port AgentCardValidator for v0.3 AgentCard or skip validation in compat layer + // AgentCardValidator.validateTransportConfiguration(agentCard); + } + + public RestHandler(AgentCard agentCard, Executor executor, Convert03To10RequestHandler requestHandler) { + this.agentCard = agentCard; + this.executor = executor; + this.requestHandler = requestHandler; + } + + public HTTPRestResponse sendMessage(String body, ServerCallContext context) { + try { + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder request = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + parseRequestBody(body, request); + EventKind result = requestHandler.onMessageSend(ProtoUtils.FromProto.messageSendParams(request), context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.SendMessageResponse.newBuilder(ProtoUtils.ToProto.taskOrMessage(result))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse sendStreamingMessage(String body, ServerCallContext context) { + try { + if (!agentCard.capabilities().streaming()) { + return createErrorResponse(new InvalidRequestError("Streaming is not supported by the agent")); + } + org.a2aproject.sdk.compat03.grpc.SendMessageRequest.Builder request = org.a2aproject.sdk.compat03.grpc.SendMessageRequest.newBuilder(); + parseRequestBody(body, request); + Flow.Publisher publisher = requestHandler.onMessageSendStream(ProtoUtils.FromProto.messageSendParams(request), context); + return createStreamingResponse(publisher); + } catch (A2AError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(ErrorConverter.convertA2AError(e)).toJson())); + } catch (JSONRPCError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(e).toJson())); + } catch (Throwable throwable) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(new InternalError(throwable.getMessage())).toJson())); + } + } + + public HTTPRestResponse cancelTask(String taskId, ServerCallContext context) { + try { + if (taskId == null || taskId.isEmpty()) { + throw new InvalidParamsError(); + } + TaskIdParams params = new TaskIdParams(taskId); + Task task = requestHandler.onCancelTask(params, context); + if (task != null) { + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.Task.newBuilder(ProtoUtils.ToProto.task(task))); + } + throw new UnsupportedOperationError(); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse setTaskPushNotificationConfiguration(String taskId, String body, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError(); + } + org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.Builder builder = org.a2aproject.sdk.compat03.grpc.CreateTaskPushNotificationConfigRequest.newBuilder(); + parseRequestBody(body, builder); + TaskPushNotificationConfig result = requestHandler.onSetTaskPushNotificationConfig(ProtoUtils.FromProto.taskPushNotificationConfig(builder), context); + return createSuccessResponse(201, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(ProtoUtils.ToProto.taskPushNotificationConfig(result))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse resubscribeTask(String taskId, ServerCallContext context) { + try { + if (!agentCard.capabilities().streaming()) { + return createErrorResponse(new InvalidRequestError("Streaming is not supported by the agent")); + } + TaskIdParams params = new TaskIdParams(taskId); + Flow.Publisher publisher = requestHandler.onResubscribeToTask(params, context); + return createStreamingResponse(publisher); + } catch (A2AError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(ErrorConverter.convertA2AError(e)).toJson())); + } catch (JSONRPCError e) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(e).toJson())); + } catch (Throwable throwable) { + return new HTTPRestStreamingResponse(ZeroPublisher.fromItems(new HTTPRestErrorResponse(new InternalError(throwable.getMessage())).toJson())); + } + } + + public HTTPRestResponse getTask(String taskId, int historyLength, ServerCallContext context) { + try { + TaskQueryParams params = new TaskQueryParams(taskId, historyLength); + Task task = requestHandler.onGetTask(params, context); + if (task != null) { + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.Task.newBuilder(ProtoUtils.ToProto.task(task))); + } + throw new TaskNotFoundError(); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse getTaskPushNotificationConfiguration(String taskId, @Nullable String configId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError(); + } + GetTaskPushNotificationConfigParams params = new GetTaskPushNotificationConfigParams(taskId, configId); + TaskPushNotificationConfig config = requestHandler.onGetTaskPushNotificationConfig(params, context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.TaskPushNotificationConfig.newBuilder(ProtoUtils.ToProto.taskPushNotificationConfig(config))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse listTaskPushNotificationConfigurations(String taskId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError(); + } + ListTaskPushNotificationConfigParams params = new ListTaskPushNotificationConfigParams(taskId); + List configs = requestHandler.onListTaskPushNotificationConfig(params, context); + return createSuccessResponse(200, org.a2aproject.sdk.compat03.grpc.ListTaskPushNotificationConfigResponse.newBuilder(ProtoUtils.ToProto.listTaskPushNotificationConfigResponse(configs))); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + public HTTPRestResponse deleteTaskPushNotificationConfiguration(String taskId, String configId, ServerCallContext context) { + try { + if (!agentCard.capabilities().pushNotifications()) { + throw new PushNotificationNotSupportedError(); + } + DeleteTaskPushNotificationConfigParams params = new DeleteTaskPushNotificationConfigParams(taskId, configId); + requestHandler.onDeleteTaskPushNotificationConfig(params, context); + return new HTTPRestResponse(204, "application/json", ""); + } catch (A2AError e) { + return createErrorResponse(ErrorConverter.convertA2AError(e)); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable throwable) { + return createErrorResponse(new InternalError(throwable.getMessage())); + } + } + + private void parseRequestBody(String body, com.google.protobuf.Message.Builder builder) throws JSONRPCError { + try { + if (body == null || body.trim().isEmpty()) { + throw new InvalidRequestError("Request body is required"); + } + validate(body); + JsonFormat.parser().merge(body, builder); + } catch (InvalidProtocolBufferException e) { + log.log(Level.SEVERE, "Error parsing JSON request body: {0}", body); + log.log(Level.SEVERE, "Parse error details", e); + throw new InvalidParamsError("Failed to parse request body: " + e.getMessage()); + } + } + + private void validate(String json) { + try { + JsonParser.parseString(json); + } catch (JsonSyntaxException e) { + throw new JSONParseError(JSONParseError.DEFAULT_CODE, "Failed to parse json", e.getMessage()); + } + } + + private HTTPRestResponse createSuccessResponse(int statusCode, com.google.protobuf.Message.Builder builder) { + try { + String jsonBody = JsonFormat.printer().print(builder); + return new HTTPRestResponse(statusCode, "application/json", jsonBody); + } catch (InvalidProtocolBufferException e) { + return createErrorResponse(new InternalError("Failed to serialize response: " + e.getMessage())); + } + } + + public HTTPRestResponse createErrorResponse(JSONRPCError error) { + int statusCode = mapErrorToHttpStatus(error); + return createErrorResponse(statusCode, error); + } + + private HTTPRestResponse createErrorResponse(int statusCode, JSONRPCError error) { + String jsonBody = new HTTPRestErrorResponse(error).toJson(); + return new HTTPRestResponse(statusCode, "application/json", jsonBody); + } + + private HTTPRestStreamingResponse createStreamingResponse(Flow.Publisher publisher) { + return new HTTPRestStreamingResponse(convertToSendStreamingMessageResponse(publisher)); + } + + @SuppressWarnings("FutureReturnValueIgnored") + private Flow.Publisher convertToSendStreamingMessageResponse( + Flow.Publisher publisher) { + // We can't use the normal convertingProcessor since that propagates any errors as an error handled + // via Subscriber.onError() rather than as part of the SendStreamingResponse payload + return ZeroPublisher.create(createTubeConfig(), tube -> { + CompletableFuture.runAsync(() -> { + publisher.subscribe(new Flow.Subscriber() { + Flow.@Nullable Subscription subscription; + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(StreamingEventKind item) { + try { + String payload = JsonFormat.printer().omittingInsignificantWhitespace().print(ProtoUtils.ToProto.taskOrMessageStream(item)); + tube.send(payload); + if (subscription != null) { + subscription.request(1); + } + } catch (InvalidProtocolBufferException ex) { + onError(ex); + } + } + + @Override + public void onError(Throwable throwable) { + if (throwable instanceof JSONRPCError jsonrpcError) { + tube.send(new HTTPRestErrorResponse(jsonrpcError).toJson()); + } else { + tube.send(new HTTPRestErrorResponse(new InternalError(throwable.getMessage())).toJson()); + } + onComplete(); + } + + @Override + public void onComplete() { + tube.complete(); + } + }); + }, executor); + }); + } + + private int mapErrorToHttpStatus(JSONRPCError error) { + if (error instanceof InvalidRequestError || error instanceof JSONParseError) { + return 400; + } + if (error instanceof InvalidParamsError) { + return 422; + } + if (error instanceof MethodNotFoundError || error instanceof TaskNotFoundError || error instanceof AuthenticatedExtendedCardNotConfiguredError) { + return 404; + } + if (error instanceof TaskNotCancelableError) { + return 409; + } + if (error instanceof PushNotificationNotSupportedError || error instanceof UnsupportedOperationError) { + return 501; + } + if (error instanceof ContentTypeNotSupportedError) { + return 415; + } + if (error instanceof InvalidAgentResponseError) { + return 502; + } + if (error instanceof InternalError) { + return 500; + } + return 500; + } + + public HTTPRestResponse getAuthenticatedExtendedCard() { + try { + if (!agentCard.supportsAuthenticatedExtendedCard() || extendedAgentCard == null || !extendedAgentCard.isResolvable()) { + throw new AuthenticatedExtendedCardNotConfiguredError(null, "Authenticated Extended Card not configured", null); + } + return new HTTPRestResponse(200, "application/json", JsonUtil.toJson(extendedAgentCard.get())); + } catch (JSONRPCError e) { + return createErrorResponse(e); + } catch (Throwable t) { + return createErrorResponse(500, new InternalError(t.getMessage())); + } + } + + public HTTPRestResponse getAgentCard() { + try { + return new HTTPRestResponse(200, "application/json", JsonUtil.toJson(agentCard)); + } catch (Throwable t) { + return createErrorResponse(500, new InternalError(t.getMessage())); + } + } + + public static class HTTPRestResponse { + + private final int statusCode; + private final String contentType; + private final String body; + + public HTTPRestResponse(int statusCode, String contentType, String body) { + this.statusCode = statusCode; + this.contentType = contentType; + this.body = body; + } + + public int getStatusCode() { + return statusCode; + } + + public String getContentType() { + return contentType; + } + + public String getBody() { + return body; + } + + @Override + public String toString() { + return "HTTPRestResponse{" + "statusCode=" + statusCode + ", contentType=" + contentType + ", body=" + body + '}'; + } + } + + public static class HTTPRestStreamingResponse extends HTTPRestResponse { + + private final Flow.Publisher publisher; + + public HTTPRestStreamingResponse(Flow.Publisher publisher) { + super(200, "text/event-stream", ""); + this.publisher = publisher; + } + + public Flow.Publisher getPublisher() { + return publisher; + } + } + + private static class HTTPRestErrorResponse { + + private final String error; + private final @Nullable + String message; + + private HTTPRestErrorResponse(JSONRPCError jsonRpcError) { + this.error = jsonRpcError.getClass().getName(); + this.message = jsonRpcError.getMessage(); + } + + private String toJson() { + return "{\"error\": \"" + error + "\", \"message\": \"" + message + "\"}"; + } + + @Override + public String toString() { + return "HTTPRestErrorResponse{" + "error=" + error + ", message=" + message + '}'; + } + } +} diff --git a/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java new file mode 100644 index 000000000..43cf2bd7d --- /dev/null +++ b/compat-0.3/transport/rest/src/main/java/org/a2aproject/sdk/compat03/transport/rest/handler/package-info.java @@ -0,0 +1,4 @@ +@NullMarked +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import org.jspecify.annotations.NullMarked; diff --git a/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandlerTest.java b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandlerTest.java new file mode 100644 index 000000000..e4ac2dd40 --- /dev/null +++ b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestHandlerTest.java @@ -0,0 +1,375 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +import java.util.HashSet; +import java.util.Map; + +import org.a2aproject.sdk.compat03.conversion.AbstractA2ARequestHandlerTest; +import org.a2aproject.sdk.compat03.conversion.mappers.domain.TaskMapper; +import org.a2aproject.sdk.compat03.spec.AgentCapabilities; +import org.a2aproject.sdk.compat03.spec.AgentCard; +import org.a2aproject.sdk.server.ServerCallContext; +import org.a2aproject.sdk.server.auth.UnauthenticatedUser; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Test suite for v0.3 RestHandler with v1.0 backend. + *

+ * Tests verify that v0.3 REST clients can successfully communicate with the v1.0 backend + * via the {@link org.a2aproject.sdk.compat03.conversion.Convert03To10RequestHandler} conversion layer. + *

+ *

+ * Phase 3 Focus: Core non-streaming tests (GetTask, SendMessage, CancelTask). + * Streaming tests are deferred to Phase 4. + *

+ */ +public class RestHandlerTest extends AbstractA2ARequestHandlerTest { + + private final ServerCallContext callContext = new ServerCallContext( + UnauthenticatedUser.INSTANCE, Map.of("foo", "bar"), new HashSet<>()); + + // ======================================== + // GetTask Tests + // ======================================== + + @Test + public void testGetTaskSuccess() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler.HTTPRestResponse response = handler.getTask(MINIMAL_TASK.getId(), 0, callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + + // Test with different version parameter + response = handler.getTask(MINIMAL_TASK.getId(), 2, callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + } + + @Test + public void testGetTaskNotFound() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + RestHandler.HTTPRestResponse response = handler.getTask("nonexistent", 0, callContext); + + Assertions.assertEquals(404, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("TaskNotFoundError")); + } + + // ======================================== + // SendMessage Tests + // ======================================== + + @Test + public void testSendMessage() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to echo the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + String requestBody = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "ROLE_USER", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + }, + "configuration": + { + "blocking": true + } + }"""; + + RestHandler.HTTPRestResponse response = handler.sendMessage(requestBody, callContext); + + Assertions.assertEquals(200, response.getStatusCode(), response.toString()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertNotNull(response.getBody()); + } + + @Test + public void testSendMessageInvalidBody() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + String invalidBody = "invalid json"; + RestHandler.HTTPRestResponse response = handler.sendMessage(invalidBody, callContext); + + Assertions.assertEquals(400, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("JSONParseError"), response.getBody()); + } + + @Test + public void testSendMessageWrongValueBody() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Invalid role value "user" instead of "ROLE_USER" + String requestBody = """ + { + "message": + { + "messageId": "message-1234", + "contextId": "context-1234", + "role": "user", + "content": [{ + "text": "tell me a joke" + }], + "metadata": { + } + } + }"""; + + RestHandler.HTTPRestResponse response = handler.sendMessage(requestBody, callContext); + + Assertions.assertEquals(422, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("InvalidParamsError")); + } + + @Test + public void testSendMessageEmptyBody() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + RestHandler.HTTPRestResponse response = handler.sendMessage("", callContext); + + Assertions.assertEquals(400, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("InvalidRequestError")); + } + + // ======================================== + // CancelTask Tests + // ======================================== + + @Test + public void testCancelTaskSuccess() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save v0.3 task by converting to v1.0 + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // Configure agent to cancel the task + agentExecutorCancel = (context, emitter) -> { + emitter.cancel(); + }; + + RestHandler.HTTPRestResponse response = handler.cancelTask(MINIMAL_TASK.getId(), callContext); + + Assertions.assertEquals(200, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains(MINIMAL_TASK.getId())); + } + + @Test + public void testCancelTaskNotFound() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + RestHandler.HTTPRestResponse response = handler.cancelTask("nonexistent", callContext); + + Assertions.assertEquals(404, response.getStatusCode()); + Assertions.assertEquals("application/json", response.getContentType()); + Assertions.assertTrue(response.getBody().contains("TaskNotFoundError")); + } + + // ======================================== + // Streaming Tests + // ======================================== + + @Test + public void testSendStreamingMessageSuccess() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Configure agent to emit the message back + agentExecutorExecute = (context, emitter) -> { + emitter.emitEvent(context.getMessage()); + }; + + String requestBody = """ + { + "message": { + "role": "ROLE_USER", + "content": [ + { + "text": "tell me some jokes" + } + ], + "messageId": "message-1234", + "contextId": "context-1234" + }, + "configuration": { + "acceptedOutputModes": ["text"] + } + }"""; + + RestHandler.HTTPRestResponse response = handler.sendStreamingMessage(requestBody, callContext); + + // Verify streaming response + assertEquals(200, response.getStatusCode(), response.toString()); + assertInstanceOf(RestHandler.HTTPRestStreamingResponse.class, response, + "Response should be HTTPRestStreamingResponse"); + + RestHandler.HTTPRestStreamingResponse streamingResponse = + (RestHandler.HTTPRestStreamingResponse) response; + assertNotNull(streamingResponse.getPublisher(), "Publisher should not be null"); + assertEquals("text/event-stream", streamingResponse.getContentType(), + "Content type should be text/event-stream for SSE"); + } + + @Test + public void testSendStreamingMessageNotSupported() { + // Create agent card with streaming disabled + AgentCard nonStreamingCard = new AgentCard.Builder(CARD) + .capabilities(new AgentCapabilities(false, true, false, null)) + .build(); + + RestHandler handler = new RestHandler(nonStreamingCard, internalExecutor, convert03To10Handler); + + String requestBody = """ + { + "message": { + "contextId": "ctx123", + "role": "ROLE_USER", + "content": [{ + "text": "Hello" + }] + } + }"""; + + RestHandler.HTTPRestResponse response = handler.sendStreamingMessage(requestBody, callContext); + + // Verify error response + assertEquals(400, response.getStatusCode(), "Should return 400 for streaming not supported"); + assertTrue(response.getBody().contains("InvalidRequestError"), + "Error should be InvalidRequestError"); + assertTrue(response.getBody().contains("Streaming is not supported by the agent"), + "Error message should indicate streaming not supported"); + } + + // ======================================== + // Push Notification Tests + // ======================================== + + @Test + public void testPushNotificationConfigSuccess() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + String requestBody = """ + { + "parent": "tasks/%s", + "config": { + "name": "tasks/%s/pushNotificationConfigs/", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }""".formatted(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + + RestHandler.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), requestBody, callContext); + + assertEquals(201, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + assertNotNull(response.getBody()); + } + + @Test + public void testPushNotificationConfigNotSupported() { + AgentCard card = createAgentCard(true, false, false); + RestHandler handler = new RestHandler(card, internalExecutor, convert03To10Handler); + + String requestBody = """ + { + "taskId": "%s", + "pushNotificationConfig": { + "url": "http://example.com" + } + } + """.formatted(MINIMAL_TASK.getId()); + + RestHandler.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), requestBody, callContext); + + assertEquals(501, response.getStatusCode()); + assertTrue(response.getBody().contains("PushNotificationNotSupportedError")); + } + + @Test + public void testGetPushNotificationConfig() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + // First, create a push notification config + String createRequestBody = """ + { + "parent": "tasks/%s", + "config": { + "name": "tasks/%s/pushNotificationConfigs/", + "pushNotificationConfig": { + "url": "https://example.com/callback", + "authentication": { + "schemes": ["jwt"] + } + } + } + }""".formatted(MINIMAL_TASK.getId(), MINIMAL_TASK.getId()); + RestHandler.HTTPRestResponse response = handler.setTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), createRequestBody, callContext); + assertEquals(201, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + + // Now get it (using taskId as configId since that's the default) + response = handler.getTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), MINIMAL_TASK.getId(), callContext); + assertEquals(200, response.getStatusCode(), response.toString()); + assertEquals("application/json", response.getContentType()); + } + + @Test + public void testDeletePushNotificationConfig() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler.HTTPRestResponse response = handler.deleteTaskPushNotificationConfiguration(MINIMAL_TASK.getId(), MINIMAL_TASK.getId(), callContext); + assertEquals(204, response.getStatusCode()); + } + + @Test + public void testListPushNotificationConfigs() { + RestHandler handler = new RestHandler(CARD, internalExecutor, convert03To10Handler); + + // Save task to v1.0 backend + taskStore.save(TaskMapper.INSTANCE.toV10(MINIMAL_TASK), false); + + RestHandler.HTTPRestResponse response = handler.listTaskPushNotificationConfigurations(MINIMAL_TASK.getId(), callContext); + + assertEquals(200, response.getStatusCode()); + assertEquals("application/json", response.getContentType()); + } +} diff --git a/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata.java b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata.java new file mode 100644 index 000000000..ebb2f27df --- /dev/null +++ b/compat-0.3/transport/rest/src/test/java/org/a2aproject/sdk/compat03/transport/rest/handler/RestTestTransportMetadata.java @@ -0,0 +1,9 @@ +package org.a2aproject.sdk.compat03.transport.rest.handler; + +// TODO: Uncomment when server-common is ported + +/** + * Placeholder stub - awaiting server-common port. + */ +public class RestTestTransportMetadata { +} diff --git a/pom.xml b/pom.xml index 8078b339a..68b531dc4 100644 --- a/pom.xml +++ b/pom.xml @@ -577,6 +577,9 @@ transport/grpc transport/rest + + compat-0.3 + boms/extras boms/reference