* This adapter handles polymorphic deserialization based on the error code, creating the * appropriate subclass instance. @@ -279,12 +279,12 @@ Throwable read(JsonReader in) throws java.io.IOException { *
* The {@code result} field must be absent or null in error responses. This class
* enforces that constraint by fixing the result type parameter to {@code Void}.
*
- * @see JSONRPCError
- * @see JSONRPCResponse
+ * @see A2AError
+ * @see A2AResponse
* @see JSON-RPC 2.0 Response Object
*/
-public final class JSONRPCErrorResponse extends JSONRPCResponse
* This sealed interface defines the fundamental structure shared by all JSON-RPC 2.0
* messages used in the A2A Protocol's JSON-RPC transport layer. It ensures type safety
- * and exhaustiveness checking by permitting only {@link JSONRPCRequest} and {@link JSONRPCResponse}
+ * and exhaustiveness checking by permitting only {@link A2ARequest} and {@link A2AResponse}
* as implementing types.
*
* According to the JSON-RPC 2.0 specification, all messages must include a {@code jsonrpc}
* version field set to "2.0", and may optionally include an {@code id} field for correlation
* between requests and responses.
*
- * @see JSONRPCRequest
- * @see JSONRPCResponse
+ * @see A2ARequest
+ * @see A2AResponse
* @see JSON-RPC 2.0 Specification
* @see A2A Protocol Specification
*/
-public sealed interface JSONRPCMessage permits JSONRPCRequest, JSONRPCResponse {
+public sealed interface A2AMessage permits A2ARequest, A2AResponse {
/**
* The JSON-RPC protocol version string as defined by the JSON-RPC 2.0 specification.
diff --git a/spec/src/main/java/io/a2a/spec/JSONRPCRequest.java b/jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/A2ARequest.java
similarity index 94%
rename from spec/src/main/java/io/a2a/spec/JSONRPCRequest.java
rename to jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/A2ARequest.java
index b09d445e5..e7200219a 100644
--- a/spec/src/main/java/io/a2a/spec/JSONRPCRequest.java
+++ b/jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/A2ARequest.java
@@ -1,4 +1,4 @@
-package io.a2a.spec;
+package io.a2a.jsonrpc.common.wrappers;
import io.a2a.util.Assert;
import io.a2a.util.Utils;
@@ -28,7 +28,7 @@
* @see JSON-RPC 2.0 Specification
* @see A2A Protocol Specification
*/
-public abstract sealed class JSONRPCRequest
@@ -21,9 +27,6 @@
*/
public final class CancelTaskRequest extends NonStreamingJSONRPCRequest
@@ -17,9 +22,6 @@
*/
public final class DeleteTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest
- * If an error occurs during deletion, the error field will contain a {@link JSONRPCError}.
+ * If an error occurs during deletion, the error field will contain a {@link A2AError}.
*
* @see DeleteTaskPushNotificationConfigRequest for the corresponding request
* @see A2A Protocol Specification
*/
-public final class DeleteTaskPushNotificationConfigResponse extends JSONRPCResponse
@@ -28,9 +33,6 @@
*/
public final class GetAuthenticatedExtendedCardRequest extends NonStreamingJSONRPCRequest
* If the agent doesn't support authenticated extended cards or authentication fails,
- * the error field will contain a {@link JSONRPCError} such as
+ * the error field will contain a {@link A2AError} such as
* {@link AuthenticatedExtendedCardNotConfiguredError}.
*
* @see GetAuthenticatedExtendedCardRequest for the corresponding request
@@ -16,7 +20,7 @@
* @see AuthenticatedExtendedCardNotConfiguredError for the error when unsupported
* @see A2A Protocol Specification
*/
-public final class GetAuthenticatedExtendedCardResponse extends JSONRPCResponse
@@ -17,9 +22,6 @@
*/
public final class GetTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest
* If no configuration exists or an error occurs, the error field will contain a
- * {@link JSONRPCError}.
+ * {@link A2AError}.
*
* @see GetTaskPushNotificationConfigRequest for the corresponding request
* @see TaskPushNotificationConfig for the configuration structure
* @see A2A Protocol Specification
*/
-public final class GetTaskPushNotificationConfigResponse extends JSONRPCResponse
@@ -18,9 +23,6 @@
*/
public final class GetTaskRequest extends NonStreamingJSONRPCRequest
@@ -17,9 +23,6 @@
*/
public final class ListTaskPushNotificationConfigRequest extends NonStreamingJSONRPCRequest
- * If an error occurs, the error field will contain a {@link JSONRPCError}.
+ * If an error occurs, the error field will contain a {@link A2AError}.
*
* @see ListTaskPushNotificationConfigRequest for the corresponding request
* @see ListTaskPushNotificationConfigResult for the result structure
* @see TaskPushNotificationConfig for the configuration structure
* @see A2A Protocol Specification
*/
-public final class ListTaskPushNotificationConfigResponse extends JSONRPCResponse
@@ -20,7 +25,7 @@
* with the {@code SendStreamingMessage} method instead.
*
* This class includes a fluent {@link Builder} for convenient request construction. The method
- * name is fixed as {@value #METHOD} and is set automatically by the constructor.
+ * name is fixed as "SendMessage" and is set automatically by the constructor.
*
* @see SendStreamingMessageRequest
* @see MessageSendParams
@@ -29,11 +34,6 @@
*/
public final class SendMessageRequest extends NonStreamingJSONRPCRequest
@@ -46,7 +46,7 @@ public final class SendMessageRequest extends NonStreamingJSONRPCRequest
* Example usage:
diff --git a/spec/src/main/java/io/a2a/spec/SendMessageResponse.java b/jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/SendMessageResponse.java
similarity index 75%
rename from spec/src/main/java/io/a2a/spec/SendMessageResponse.java
rename to jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/SendMessageResponse.java
index da01aa827..4f576dd01 100644
--- a/spec/src/main/java/io/a2a/spec/SendMessageResponse.java
+++ b/jsonrpc-common/src/main/java/io/a2a/jsonrpc/common/wrappers/SendMessageResponse.java
@@ -1,9 +1,12 @@
-package io.a2a.spec;
+package io.a2a.jsonrpc.common.wrappers;
+
+import io.a2a.spec.A2AError;
+import io.a2a.spec.EventKind;
/**
* The response after receiving a send message request.
*/
-public final class SendMessageResponse extends JSONRPCResponse
@@ -21,9 +26,6 @@
*/
public final class SendStreamingMessageRequest extends StreamingJSONRPCRequest
* If push notifications are not supported or an error occurs, the error field will contain
- * a {@link JSONRPCError} (e.g., {@link PushNotificationNotSupportedError}).
+ * a {@link A2AError} (e.g., {@link PushNotificationNotSupportedError}).
*
* @see SetTaskPushNotificationConfigRequest for the corresponding request
* @see TaskPushNotificationConfig for the configuration structure
* @see PushNotificationNotSupportedError for the error when unsupported
* @see A2A Protocol Specification
*/
-public final class SetTaskPushNotificationConfigResponse extends JSONRPCResponse
- * This sealed class extends {@link JSONRPCRequest} to provide specialized support for
+ * This sealed class extends {@link A2ARequest} to provide specialized support for
* A2A Protocol methods that return streaming responses. Streaming requests enable
* server-sent events and real-time updates to be pushed to clients as they occur,
* rather than waiting for a complete response.
@@ -27,7 +29,7 @@
* @see StreamingEventKind
* @see A2A Protocol Specification
*/
-public abstract sealed class StreamingJSONRPCRequest
@@ -24,9 +29,6 @@
*/
public final class SubscribeToTaskRequest extends StreamingJSONRPCRequest
+ * Internal Use Only: Classes in this package are implementation details.
+ * The public API is in {@code io.a2a.spec}.
+ *
+ * @see io.a2a.spec
+ * @see JSON-RPC 2.0 Specification
+ */
+package io.a2a.jsonrpc.common.wrappers;
diff --git a/spec/src/test/java/io/a2a/spec/JSONRPCErrorSerializationTest.java b/jsonrpc-common/src/test/java/io/a2a/jsonrpc/common/json/A2AErrorSerializationTest.java
similarity index 72%
rename from spec/src/test/java/io/a2a/spec/JSONRPCErrorSerializationTest.java
rename to jsonrpc-common/src/test/java/io/a2a/jsonrpc/common/json/A2AErrorSerializationTest.java
index 684f8a256..ff7ee5cc1 100644
--- a/spec/src/test/java/io/a2a/spec/JSONRPCErrorSerializationTest.java
+++ b/jsonrpc-common/src/test/java/io/a2a/jsonrpc/common/json/A2AErrorSerializationTest.java
@@ -1,11 +1,5 @@
-package io.a2a.spec;
+package io.a2a.jsonrpc.common.json;
-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 static io.a2a.spec.A2AErrorCodes.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE;
import static io.a2a.spec.A2AErrorCodes.INTERNAL_ERROR_CODE;
import static io.a2a.spec.A2AErrorCodes.INVALID_AGENT_RESPONSE_ERROR_CODE;
@@ -17,19 +11,34 @@
import static io.a2a.spec.A2AErrorCodes.TASK_NOT_CANCELABLE_ERROR_CODE;
import static io.a2a.spec.A2AErrorCodes.TASK_NOT_FOUND_ERROR_CODE;
import static io.a2a.spec.A2AErrorCodes.UNSUPPORTED_OPERATION_ERROR_CODE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import io.a2a.json.JsonProcessingException;
-import io.a2a.json.JsonUtil;
+import java.util.List;
+
+import io.a2a.spec.A2AError;
+import io.a2a.spec.ContentTypeNotSupportedError;
+import io.a2a.spec.InternalError;
+import io.a2a.spec.InvalidAgentResponseError;
+import io.a2a.spec.InvalidParamsError;
+import io.a2a.spec.InvalidRequestError;
+import io.a2a.spec.JSONParseError;
+import io.a2a.spec.MethodNotFoundError;
+import io.a2a.spec.PushNotificationNotSupportedError;
+import io.a2a.spec.TaskNotCancelableError;
+import io.a2a.spec.TaskNotFoundError;
+import io.a2a.spec.UnsupportedOperationError;
+import org.junit.jupiter.api.Test;
-public class JSONRPCErrorSerializationTest {
+public class A2AErrorSerializationTest {
@Test
- public void shouldDeserializeToCorrectJSONRPCErrorSubclass() throws JsonProcessingException {
+ public void shouldDeserializeToCorrectA2AErrorSubclass() throws JsonProcessingException {
String jsonTemplate = """
{"code": %s, "message": "error", "data": "anything"}
""";
- record ErrorCase(int code, Class extends JSONRPCError> clazz) {}
+ record ErrorCase(int code, Class extends A2AError> clazz) {}
List
- * This exception encapsulates a {@link JSONRPCError} for handling + * This exception encapsulates a {@link A2AError} for handling * protocol-level errors during JSON-RPC request processing. *
*/ public class JSONRPCException extends Exception{ - private final JSONRPCError error; + private final A2AError error; /** * Creates a JSONRPCException wrapping the specified error. * * @param error the JSON-RPC error */ - public JSONRPCException(JSONRPCError error) { + public JSONRPCException(A2AError error) { this.error = error; } @@ -26,7 +26,7 @@ public JSONRPCException(JSONRPCError error) { * * @return the JSON-RPC error */ - public JSONRPCError getError() { + public A2AError getError() { return error; } } diff --git a/server-common/src/main/java/io/a2a/server/agentexecution/AgentExecutor.java b/server-common/src/main/java/io/a2a/server/agentexecution/AgentExecutor.java index f753fed54..caa0c5cbf 100644 --- a/server-common/src/main/java/io/a2a/server/agentexecution/AgentExecutor.java +++ b/server-common/src/main/java/io/a2a/server/agentexecution/AgentExecutor.java @@ -1,10 +1,10 @@ package io.a2a.server.agentexecution; import io.a2a.server.events.EventQueue; -import io.a2a.spec.JSONRPCError; +import io.a2a.spec.A2AError; public interface AgentExecutor { - void execute(RequestContext context, EventQueue eventQueue) throws JSONRPCError; + void execute(RequestContext context, EventQueue eventQueue) throws A2AError; - void cancel(RequestContext context, EventQueue eventQueue) throws JSONRPCError; + void cancel(RequestContext context, EventQueue eventQueue) throws A2AError; } diff --git a/server-common/src/main/java/io/a2a/server/agentexecution/RequestContext.java b/server-common/src/main/java/io/a2a/server/agentexecution/RequestContext.java index 0aa775649..0613d334c 100644 --- a/server-common/src/main/java/io/a2a/server/agentexecution/RequestContext.java +++ b/server-common/src/main/java/io/a2a/server/agentexecution/RequestContext.java @@ -6,8 +6,6 @@ import java.util.UUID; import java.util.stream.Collectors; -import org.jspecify.annotations.Nullable; - import io.a2a.server.ServerCallContext; import io.a2a.spec.InvalidParamsError; import io.a2a.spec.Message; @@ -16,6 +14,7 @@ import io.a2a.spec.Part; import io.a2a.spec.Task; import io.a2a.spec.TextPart; +import org.jspecify.annotations.Nullable; public class RequestContext { diff --git a/server-common/src/main/java/io/a2a/server/events/EventConsumer.java b/server-common/src/main/java/io/a2a/server/events/EventConsumer.java index d4fd7b682..7f1cbd4cc 100644 --- a/server-common/src/main/java/io/a2a/server/events/EventConsumer.java +++ b/server-common/src/main/java/io/a2a/server/events/EventConsumer.java @@ -2,8 +2,6 @@ import java.util.concurrent.Flow; -import org.jspecify.annotations.Nullable; - import io.a2a.spec.A2AServerException; import io.a2a.spec.Event; import io.a2a.spec.Message; @@ -12,6 +10,7 @@ import mutiny.zero.BackpressureStrategy; import mutiny.zero.TubeConfiguration; import mutiny.zero.ZeroPublisher; +import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server-common/src/main/java/io/a2a/server/events/EventQueue.java b/server-common/src/main/java/io/a2a/server/events/EventQueue.java index 7ce8ad3aa..a08f63084 100644 --- a/server-common/src/main/java/io/a2a/server/events/EventQueue.java +++ b/server-common/src/main/java/io/a2a/server/events/EventQueue.java @@ -9,10 +9,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.jspecify.annotations.Nullable; - import io.a2a.server.tasks.TaskStateProvider; import io.a2a.spec.Event; +import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server-common/src/main/java/io/a2a/server/events/InMemoryQueueManager.java b/server-common/src/main/java/io/a2a/server/events/InMemoryQueueManager.java index 2ab9070d3..19179f50d 100644 --- a/server-common/src/main/java/io/a2a/server/events/InMemoryQueueManager.java +++ b/server-common/src/main/java/io/a2a/server/events/InMemoryQueueManager.java @@ -6,9 +6,8 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import org.jspecify.annotations.Nullable; - import io.a2a.server.tasks.TaskStateProvider; +import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server-common/src/main/java/io/a2a/server/extensions/A2AExtensions.java b/server-common/src/main/java/io/a2a/server/extensions/A2AExtensions.java index 39f65a994..a83128a1a 100644 --- a/server-common/src/main/java/io/a2a/server/extensions/A2AExtensions.java +++ b/server-common/src/main/java/io/a2a/server/extensions/A2AExtensions.java @@ -4,10 +4,9 @@ import java.util.List; import java.util.Set; -import org.jspecify.annotations.Nullable; - import io.a2a.spec.AgentCard; import io.a2a.spec.AgentExtension; +import org.jspecify.annotations.Nullable; public class A2AExtensions { diff --git a/server-common/src/main/java/io/a2a/server/requesthandlers/DefaultRequestHandler.java b/server-common/src/main/java/io/a2a/server/requesthandlers/DefaultRequestHandler.java index 39fb01104..f3cb6f02e 100644 --- a/server-common/src/main/java/io/a2a/server/requesthandlers/DefaultRequestHandler.java +++ b/server-common/src/main/java/io/a2a/server/requesthandlers/DefaultRequestHandler.java @@ -3,7 +3,7 @@ import static io.a2a.server.util.async.AsyncUtils.convertingProcessor; import static io.a2a.server.util.async.AsyncUtils.createTubeConfig; import static io.a2a.server.util.async.AsyncUtils.processor; -import static java.util.concurrent.TimeUnit.*; +import static java.util.concurrent.TimeUnit.SECONDS; import java.time.Instant; import java.util.HashMap; @@ -21,16 +21,16 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; +import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import org.jspecify.annotations.Nullable; -import org.jspecify.annotations.NonNull; - +import io.a2a.jsonrpc.common.wrappers.ListTasksResult; import io.a2a.server.ServerCallContext; import io.a2a.server.agentexecution.AgentExecutor; import io.a2a.server.agentexecution.RequestContext; import io.a2a.server.agentexecution.SimpleRequestContextBuilder; +import io.a2a.server.config.A2AConfigProvider; import io.a2a.server.events.EnhancedRunnable; import io.a2a.server.events.EventConsumer; import io.a2a.server.events.EventQueue; @@ -43,17 +43,16 @@ import io.a2a.server.tasks.TaskManager; import io.a2a.server.tasks.TaskStore; import io.a2a.server.util.async.Internal; +import io.a2a.spec.A2AError; import io.a2a.spec.DeleteTaskPushNotificationConfigParams; import io.a2a.spec.Event; import io.a2a.spec.EventKind; import io.a2a.spec.GetTaskPushNotificationConfigParams; import io.a2a.spec.InternalError; import io.a2a.spec.InvalidParamsError; -import io.a2a.spec.JSONRPCError; import io.a2a.spec.ListTaskPushNotificationConfigParams; import io.a2a.spec.ListTaskPushNotificationConfigResult; import io.a2a.spec.ListTasksParams; -import io.a2a.spec.ListTasksResult; import io.a2a.spec.Message; import io.a2a.spec.MessageSendParams; import io.a2a.spec.PushNotificationConfig; @@ -66,8 +65,8 @@ import io.a2a.spec.TaskQueryParams; import io.a2a.spec.TaskState; import io.a2a.spec.UnsupportedOperationError; -import io.a2a.server.config.A2AConfigProvider; -import jakarta.annotation.PostConstruct; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -155,7 +154,7 @@ public static DefaultRequestHandler create(AgentExecutor agentExecutor, TaskStor } @Override - public Task onGetTask(TaskQueryParams params, ServerCallContext context) throws JSONRPCError { + public Task onGetTask(TaskQueryParams params, ServerCallContext context) throws A2AError { LOGGER.debug("onGetTask {}", params.id()); Task task = taskStore.get(params.id()); if (task == null) { @@ -188,7 +187,7 @@ private static Task limitTaskHistory(Task task, @Nullable Integer historyLength) } @Override - public ListTasksResult onListTasks(ListTasksParams params, ServerCallContext context) throws JSONRPCError { + public ListTasksResult onListTasks(ListTasksParams params, ServerCallContext context) throws A2AError { LOGGER.debug("onListTasks with contextId={}, status={}, pageSize={}, pageToken={}, lastUpdatedAfter={}", params.contextId(), params.status(), params.pageSize(), params.pageToken(), params.lastUpdatedAfter()); @@ -210,7 +209,7 @@ public ListTasksResult onListTasks(ListTasksParams params, ServerCallContext con } @Override - public Task onCancelTask(TaskIdParams params, ServerCallContext context) throws JSONRPCError { + public Task onCancelTask(TaskIdParams params, ServerCallContext context) throws A2AError { Task task = taskStore.get(params.id()); if (task == null) { throw new TaskNotFoundError(); @@ -262,7 +261,7 @@ public Task onCancelTask(TaskIdParams params, ServerCallContext context) throws } @Override - public EventKind onMessageSend(MessageSendParams params, ServerCallContext context) throws JSONRPCError { + public EventKind onMessageSend(MessageSendParams params, ServerCallContext context) throws A2AError { LOGGER.debug("onMessageSend - task: {}; context {}", params.message().taskId(), params.message().contextId()); MessageSendSetup mss = initMessageSend(params, context); @@ -398,7 +397,7 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte @Override public Flow.Publisher* Handles conversion with null handling for nextPageToken field. * Uses ADDER_PREFERRED strategy to avoid ProtocolMessageList instantiation issues. diff --git a/spec-grpc/src/main/java/io/a2a/grpc/mapper/SubscribeToTaskRequestMapper.java b/spec-grpc/src/main/java/io/a2a/grpc/mapper/SubscribeToTaskRequestMapper.java index 10faa303f..4768fd5c7 100644 --- a/spec-grpc/src/main/java/io/a2a/grpc/mapper/SubscribeToTaskRequestMapper.java +++ b/spec-grpc/src/main/java/io/a2a/grpc/mapper/SubscribeToTaskRequestMapper.java @@ -1,10 +1,10 @@ package io.a2a.grpc.mapper; -import io.a2a.spec.SubscribeToTaskRequest; +import io.a2a.jsonrpc.common.wrappers.SubscribeToTaskRequest; import org.mapstruct.Mapper; /** - * Mapper between {@link io.a2a.spec.SubscribeToTaskRequest} and {@link io.a2a.grpc.SubscribeToTaskRequest}. + * Mapper between {@link SubscribeToTaskRequest} and {@link io.a2a.grpc.SubscribeToTaskRequest}. *
* The mapping handles the structural difference between domain and proto representations: *
@@ -7,7 +9,7 @@ * in the A2A Protocol's event stream. All protocol-level errors implement this interface, * enabling uniform error handling across both streaming and non-streaming communication. *
- * A2A errors typically extend {@link JSONRPCError} to provide JSON-RPC 2.0 compliant + * A2A errors typically extend {@link A2AError} to provide JSON-RPC 2.0 compliant * error responses with standard error codes, messages, and optional additional data. *
* Common implementations include: @@ -21,9 +23,68 @@ *
+ * 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 A2AError(Integer code, String message, Object data) { + super(message); + Assert.checkNotNullParam("code", code); + Assert.checkNotNullParam("message", message); + this.code = code; + this.data = data; + } + + /** + * Gets the numeric error code indicating the error type. + *
+ * Standard JSON-RPC 2.0 error codes: + *
+ * The structure and type of the data field is defined by the specific error code. + * It may contain detailed debugging information, validation errors, or other + * context-specific data to help diagnose the error. + * + * @return the error data, or null if not provided + */ + public Object getData() { + return data; + } } diff --git a/spec/src/main/java/io/a2a/spec/A2AMethods.java b/spec/src/main/java/io/a2a/spec/A2AMethods.java new file mode 100644 index 000000000..0ffdf6e30 --- /dev/null +++ b/spec/src/main/java/io/a2a/spec/A2AMethods.java @@ -0,0 +1,17 @@ + +package io.a2a.spec; + +public interface A2AMethods { + String CANCEL_TASK_METHOD = "CancelTask"; + String DELETE_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "DeleteTaskPushNotificationConfig"; + String GET_EXTENDED_AGENT_CARD_METHOD = "GetExtendedAgentCard"; + String GET_TASK_METHOD = "GetTask"; + String GET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "GetTaskPushNotificationConfig"; + String LIST_TASK_METHOD = "ListTasks"; + String LIST_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "ListTaskPushNotificationConfig"; + String SEND_MESSAGE_METHOD = "SendMessage"; + String SEND_STREAMING_MESSAGE_METHOD = "SendStreamingMessage"; + String SET_TASK_PUSH_NOTIFICATION_CONFIG_METHOD = "SetTaskPushNotificationConfig"; + String SUBSCRIBE_TO_TASK_METHOD = "SubscribeToTask"; + +} diff --git a/spec/src/main/java/io/a2a/spec/APIKeySecurityScheme.java b/spec/src/main/java/io/a2a/spec/APIKeySecurityScheme.java index 01fc23509..a69c9a4ad 100644 --- a/spec/src/main/java/io/a2a/spec/APIKeySecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/APIKeySecurityScheme.java @@ -2,8 +2,6 @@ import io.a2a.util.Assert; -import static io.a2a.spec.APIKeySecurityScheme.API_KEY; - /** * API key security scheme for agent authentication. *
diff --git a/spec/src/main/java/io/a2a/spec/AgentCardSignature.java b/spec/src/main/java/io/a2a/spec/AgentCardSignature.java index aac74a412..cb6bc5c77 100644 --- a/spec/src/main/java/io/a2a/spec/AgentCardSignature.java +++ b/spec/src/main/java/io/a2a/spec/AgentCardSignature.java @@ -1,8 +1,8 @@ package io.a2a.spec; -import com.google.gson.annotations.SerializedName; import java.util.Map; +import com.google.gson.annotations.SerializedName; import io.a2a.util.Assert; /** diff --git a/spec/src/main/java/io/a2a/spec/AuthenticatedExtendedCardNotConfiguredError.java b/spec/src/main/java/io/a2a/spec/AuthenticatedExtendedCardNotConfiguredError.java index de99e54da..52650dc1f 100644 --- a/spec/src/main/java/io/a2a/spec/AuthenticatedExtendedCardNotConfiguredError.java +++ b/spec/src/main/java/io/a2a/spec/AuthenticatedExtendedCardNotConfiguredError.java @@ -7,9 +7,8 @@ /** * A2A Protocol error indicating that the agent does not have an authenticated extended card configured. *
- * This error is returned when a client attempts to retrieve an authenticated extended agent card - * via {@link GetAuthenticatedExtendedCardRequest}, but the agent has not configured authentication-protected - * extended card information. + * This error is returned when a client attempts to retrieve an authenticated extended agent card, + * but the agent has not configured authentication-protected extended card information. *
* Extended cards may contain additional agent metadata, capabilities, or configuration that * should only be accessible to authenticated clients. Agents that don't implement this feature @@ -25,11 +24,10 @@ * } * } * - * @see GetAuthenticatedExtendedCardRequest for retrieving authenticated extended cards * @see AgentCard for the base agent card structure * @see A2A Protocol Specification */ -public class AuthenticatedExtendedCardNotConfiguredError extends JSONRPCError { +public class AuthenticatedExtendedCardNotConfiguredError extends A2AError { /** * Constructs an error for agents that don't support authenticated extended card retrieval. diff --git a/spec/src/main/java/io/a2a/spec/AuthorizationCodeOAuthFlow.java b/spec/src/main/java/io/a2a/spec/AuthorizationCodeOAuthFlow.java index b895531c6..c4db756a4 100644 --- a/spec/src/main/java/io/a2a/spec/AuthorizationCodeOAuthFlow.java +++ b/spec/src/main/java/io/a2a/spec/AuthorizationCodeOAuthFlow.java @@ -2,7 +2,6 @@ import java.util.Map; - import io.a2a.util.Assert; /** diff --git a/spec/src/main/java/io/a2a/spec/ClientCredentialsOAuthFlow.java b/spec/src/main/java/io/a2a/spec/ClientCredentialsOAuthFlow.java index 88ce8a127..f248eaa70 100644 --- a/spec/src/main/java/io/a2a/spec/ClientCredentialsOAuthFlow.java +++ b/spec/src/main/java/io/a2a/spec/ClientCredentialsOAuthFlow.java @@ -3,7 +3,6 @@ import java.util.Map; - import io.a2a.util.Assert; /** diff --git a/spec/src/main/java/io/a2a/spec/ContentTypeNotSupportedError.java b/spec/src/main/java/io/a2a/spec/ContentTypeNotSupportedError.java index 9bd10192a..a696a891a 100644 --- a/spec/src/main/java/io/a2a/spec/ContentTypeNotSupportedError.java +++ b/spec/src/main/java/io/a2a/spec/ContentTypeNotSupportedError.java @@ -1,9 +1,7 @@ package io.a2a.spec; -import static io.a2a.util.Utils.defaultIfNull; - - import static io.a2a.spec.A2AErrorCodes.CONTENT_TYPE_NOT_SUPPORTED_ERROR_CODE; +import static io.a2a.util.Utils.defaultIfNull; /** * A2A Protocol error indicating incompatibility between requested content types and agent capabilities. @@ -38,7 +36,7 @@ * @see MessageSendConfiguration for client content type preferences * @see A2A Protocol Specification */ -public class ContentTypeNotSupportedError extends JSONRPCError { +public class ContentTypeNotSupportedError extends A2AError { /** * Constructs a content type not supported error. diff --git a/spec/src/main/java/io/a2a/spec/DataPart.java b/spec/src/main/java/io/a2a/spec/DataPart.java index d44e87151..163225429 100644 --- a/spec/src/main/java/io/a2a/spec/DataPart.java +++ b/spec/src/main/java/io/a2a/spec/DataPart.java @@ -4,8 +4,6 @@ import io.a2a.util.Assert; -import static io.a2a.util.Utils.SPEC_VERSION_1_0; - /** * Represents a structured data content part within a {@link Message} or {@link Artifact}. diff --git a/spec/src/main/java/io/a2a/spec/DeleteTaskPushNotificationConfigParams.java b/spec/src/main/java/io/a2a/spec/DeleteTaskPushNotificationConfigParams.java index 9745ccf2d..75faf2e54 100644 --- a/spec/src/main/java/io/a2a/spec/DeleteTaskPushNotificationConfigParams.java +++ b/spec/src/main/java/io/a2a/spec/DeleteTaskPushNotificationConfigParams.java @@ -13,7 +13,6 @@ * @param id the task identifier (required) * @param pushNotificationConfigId the specific configuration ID to delete (required) * @param tenant optional tenant, provided as a path parameter. - * @see DeleteTaskPushNotificationConfigRequest for the request using these parameters * @see A2A Protocol Specification */ public record DeleteTaskPushNotificationConfigParams(String id, String pushNotificationConfigId, String tenant) { diff --git a/spec/src/main/java/io/a2a/spec/FilePart.java b/spec/src/main/java/io/a2a/spec/FilePart.java index a1835109c..79b63fe64 100644 --- a/spec/src/main/java/io/a2a/spec/FilePart.java +++ b/spec/src/main/java/io/a2a/spec/FilePart.java @@ -3,8 +3,6 @@ import io.a2a.util.Assert; -import static io.a2a.util.Utils.SPEC_VERSION_1_0; - /** * Represents a file content part within a {@link Message} or {@link Artifact}. diff --git a/spec/src/main/java/io/a2a/spec/GetTaskPushNotificationConfigParams.java b/spec/src/main/java/io/a2a/spec/GetTaskPushNotificationConfigParams.java index 225aa4071..36f2db3fb 100644 --- a/spec/src/main/java/io/a2a/spec/GetTaskPushNotificationConfigParams.java +++ b/spec/src/main/java/io/a2a/spec/GetTaskPushNotificationConfigParams.java @@ -14,7 +14,6 @@ * @param id the task identifier (required) * @param pushNotificationConfigId optional specific configuration ID to retrieve * @param tenant optional tenant, provided as a path parameter. - * @see GetTaskPushNotificationConfigRequest for the request using these parameters * @see TaskPushNotificationConfig for the returned configuration structure * @see A2A Protocol Specification */ diff --git a/spec/src/main/java/io/a2a/spec/HTTPAuthSecurityScheme.java b/spec/src/main/java/io/a2a/spec/HTTPAuthSecurityScheme.java index 76620d868..54858562f 100644 --- a/spec/src/main/java/io/a2a/spec/HTTPAuthSecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/HTTPAuthSecurityScheme.java @@ -2,9 +2,6 @@ import io.a2a.util.Assert; -import static io.a2a.spec.HTTPAuthSecurityScheme.HTTP; -import static io.a2a.util.Utils.SPEC_VERSION_1_0; - /** * HTTP authentication security scheme for agent authentication. *
diff --git a/spec/src/main/java/io/a2a/spec/ImplicitOAuthFlow.java b/spec/src/main/java/io/a2a/spec/ImplicitOAuthFlow.java index 93d3f15ac..06341ab2b 100644 --- a/spec/src/main/java/io/a2a/spec/ImplicitOAuthFlow.java +++ b/spec/src/main/java/io/a2a/spec/ImplicitOAuthFlow.java @@ -2,7 +2,6 @@ import java.util.Map; - import io.a2a.util.Assert; /** diff --git a/spec/src/main/java/io/a2a/spec/IntegerJsonrpcId.java b/spec/src/main/java/io/a2a/spec/IntegerJsonrpcId.java deleted file mode 100644 index 386a59118..000000000 --- a/spec/src/main/java/io/a2a/spec/IntegerJsonrpcId.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.a2a.spec; - -/** - * Integer-based implementation of JSON-RPC request/response correlation identifier. - *
- * This class represents a JSON-RPC ID that uses an Integer value for correlation - * between requests and responses. According to the JSON-RPC 2.0 specification, - * Number IDs are one of the valid identifier types (along with String and NULL). - *
- * Integer IDs are commonly used when: - *
- * 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/spec/src/main/java/io/a2a/spec/JSONParseError.java b/spec/src/main/java/io/a2a/spec/JSONParseError.java index 24c4c67d2..74da3ddf5 100644 --- a/spec/src/main/java/io/a2a/spec/JSONParseError.java +++ b/spec/src/main/java/io/a2a/spec/JSONParseError.java @@ -21,12 +21,12 @@ * } * } * - * @see JSONRPCError for the base error class + * @see A2AError 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 class JSONParseError extends A2AError { /** * Constructs a JSON parse error with default message. diff --git a/spec/src/main/java/io/a2a/spec/JSONRPCError.java b/spec/src/main/java/io/a2a/spec/JSONRPCError.java deleted file mode 100644 index 860fde68d..000000000 --- a/spec/src/main/java/io/a2a/spec/JSONRPCError.java +++ /dev/null @@ -1,97 +0,0 @@ -package io.a2a.spec; - - -import io.a2a.util.Assert; - -/** - * Represents a JSON-RPC 2.0 error object as defined in the JSON-RPC 2.0 specification. - *
- * This class encapsulates error information returned in JSON-RPC error responses. - * According to the JSON-RPC 2.0 specification, an error object must contain: - *
- * This class implements {@link Event} to allow errors to be streamed to clients, - * and {@link A2AError} to integrate with the A2A Protocol's error handling system. - * It extends {@link Error} to provide standard Java error semantics with a message. - *
- * Standard error codes are defined in the JSON-RPC 2.0 specification: - *
- * 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 numeric error code indicating the error type. - *
- * Standard JSON-RPC 2.0 error codes: - *
- * The structure and type of the data field is defined by the specific error code. - * It may contain detailed debugging information, validation errors, or other - * context-specific data to help diagnose the error. - * - * @return the error data, or null if not provided - */ - public Object getData() { - return data; - } -} diff --git a/spec/src/main/java/io/a2a/spec/JsonrpcId.java b/spec/src/main/java/io/a2a/spec/JsonrpcId.java deleted file mode 100644 index 152c2a5b1..000000000 --- a/spec/src/main/java/io/a2a/spec/JsonrpcId.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.a2a.spec; - -/** - * Marker interface for JSON-RPC request/response correlation identifiers. - *
- * According to the JSON-RPC 2.0 specification, the {@code id} field must be - * a String, Number, or NULL value. This interface serves as a type marker - * for implementations that represent valid JSON-RPC IDs. - *
- * The A2A Java SDK provides two concrete implementations: - *
- * Null IDs are also valid and represent notifications (requests that do not - * expect a response). - * - * @see StringJsonrpcId - * @see IntegerJsonrpcId - * @see JSON-RPC 2.0 Request Object - */ -public interface JsonrpcId { -} diff --git a/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigParams.java b/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigParams.java index 09967e378..f339afd88 100644 --- a/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigParams.java +++ b/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigParams.java @@ -10,7 +10,6 @@ * * @param id the task identifier (required) * @param tenant optional tenant, provided as a path parameter. - * @see ListTaskPushNotificationConfigRequest for the request using these parameters * @see TaskPushNotificationConfig for the configuration structure * @see A2A Protocol Specification */ diff --git a/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigResult.java b/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigResult.java index 193b3ea9b..1ae125713 100644 --- a/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigResult.java +++ b/spec/src/main/java/io/a2a/spec/ListTaskPushNotificationConfigResult.java @@ -1,10 +1,10 @@ package io.a2a.spec; +import java.util.List; + import io.a2a.util.Assert; import org.jspecify.annotations.Nullable; -import java.util.List; - /** * Result of listing push notification configurations for a task with pagination support. * diff --git a/spec/src/main/java/io/a2a/spec/ListTasksParams.java b/spec/src/main/java/io/a2a/spec/ListTasksParams.java index 4e2cc6432..6813dcf45 100644 --- a/spec/src/main/java/io/a2a/spec/ListTasksParams.java +++ b/spec/src/main/java/io/a2a/spec/ListTasksParams.java @@ -1,10 +1,10 @@ package io.a2a.spec; +import java.time.Instant; + import io.a2a.util.Assert; import org.jspecify.annotations.Nullable; -import java.time.Instant; - /** * Parameters for listing tasks with optional filtering and pagination. * diff --git a/spec/src/main/java/io/a2a/spec/MessageSendParams.java b/spec/src/main/java/io/a2a/spec/MessageSendParams.java index 4dca5f806..1dcb6dd61 100644 --- a/spec/src/main/java/io/a2a/spec/MessageSendParams.java +++ b/spec/src/main/java/io/a2a/spec/MessageSendParams.java @@ -8,8 +8,7 @@ * Parameters for sending a message to an agent in the A2A Protocol. *
* This record encapsulates the message content, optional configuration, and metadata for - * agent task requests. It is used by both {@link SendMessageRequest} and - * {@link SendStreamingMessageRequest} to define what message to send and how to process it. + * agent task requests. It is used to define what message to send and how to process it. *
* The message can create a new task, continue an existing task (if it contains a task ID), * or restart a task depending on the agent's implementation and the message context. @@ -18,8 +17,6 @@ * @param configuration optional configuration for message processing behavior * @param metadata optional arbitrary key-value metadata for the request * @param tenant optional tenant, provided as a path parameter. - * @see SendMessageRequest for non-streaming message delivery - * @see SendStreamingMessageRequest for streaming message delivery * @see MessageSendConfiguration for available configuration options * @see A2A Protocol Specification */ diff --git a/spec/src/main/java/io/a2a/spec/MethodNotFoundError.java b/spec/src/main/java/io/a2a/spec/MethodNotFoundError.java index c56bbcf1d..e38f7a605 100644 --- a/spec/src/main/java/io/a2a/spec/MethodNotFoundError.java +++ b/spec/src/main/java/io/a2a/spec/MethodNotFoundError.java @@ -18,11 +18,9 @@ * throw new MethodNotFoundError(); * } * - * @see JSONRPCError for the base error class - * @see A2AError for the error marker interface * @see JSON-RPC 2.0 Error Codes */ -public class MethodNotFoundError extends JSONRPCError { +public class MethodNotFoundError extends A2AError { /** * Constructs error with all parameters. diff --git a/spec/src/main/java/io/a2a/spec/MutualTLSSecurityScheme.java b/spec/src/main/java/io/a2a/spec/MutualTLSSecurityScheme.java index 659df3c7a..86480258b 100644 --- a/spec/src/main/java/io/a2a/spec/MutualTLSSecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/MutualTLSSecurityScheme.java @@ -1,7 +1,5 @@ package io.a2a.spec; -import static io.a2a.spec.MutualTLSSecurityScheme.MUTUAL_TLS; - /** * Mutual TLS (mTLS) security scheme for agent authentication. *
diff --git a/spec/src/main/java/io/a2a/spec/OAuth2SecurityScheme.java b/spec/src/main/java/io/a2a/spec/OAuth2SecurityScheme.java index ee6557efc..f3179cc23 100644 --- a/spec/src/main/java/io/a2a/spec/OAuth2SecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/OAuth2SecurityScheme.java @@ -2,8 +2,6 @@ import io.a2a.util.Assert; -import static io.a2a.spec.OAuth2SecurityScheme.OAUTH2; - /** * OAuth 2.0 security scheme for agent authentication. *
diff --git a/spec/src/main/java/io/a2a/spec/OpenIdConnectSecurityScheme.java b/spec/src/main/java/io/a2a/spec/OpenIdConnectSecurityScheme.java index 0ba446cad..e7dfcfab3 100644 --- a/spec/src/main/java/io/a2a/spec/OpenIdConnectSecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/OpenIdConnectSecurityScheme.java @@ -2,8 +2,6 @@ import io.a2a.util.Assert; -import static io.a2a.spec.OpenIdConnectSecurityScheme.OPENID_CONNECT; - /** * OpenID Connect security scheme for agent authentication. *
diff --git a/spec/src/main/java/io/a2a/spec/PushNotificationNotSupportedError.java b/spec/src/main/java/io/a2a/spec/PushNotificationNotSupportedError.java index 0dd571955..1a336cc00 100644 --- a/spec/src/main/java/io/a2a/spec/PushNotificationNotSupportedError.java +++ b/spec/src/main/java/io/a2a/spec/PushNotificationNotSupportedError.java @@ -7,8 +7,7 @@ * A2A Protocol error indicating that the agent does not support push notifications. *
* This error is returned when a client attempts push notification operations - * (such as {@link SetTaskPushNotificationConfigRequest}) on an agent that has - * {@link AgentCapabilities#pushNotifications()} set to {@code false}. + * on an agent that has {@link AgentCapabilities#pushNotifications()} set to {@code false}. *
* Push notifications allow agents to proactively send task updates to clients via * HTTP callbacks. Agents that don't support this capability will return this error @@ -24,11 +23,10 @@ * } * * @see AgentCapabilities#pushNotifications() for push notification capability - * @see SetTaskPushNotificationConfigRequest for configuring push notifications * @see TaskPushNotificationConfig for push notification configuration * @see A2A Protocol Specification */ -public class PushNotificationNotSupportedError extends JSONRPCError { +public class PushNotificationNotSupportedError extends A2AError { /** * Constructs error with default message. diff --git a/spec/src/main/java/io/a2a/spec/SecurityScheme.java b/spec/src/main/java/io/a2a/spec/SecurityScheme.java index 2121a636e..322262eb9 100644 --- a/spec/src/main/java/io/a2a/spec/SecurityScheme.java +++ b/spec/src/main/java/io/a2a/spec/SecurityScheme.java @@ -1,7 +1,5 @@ package io.a2a.spec; -import static io.a2a.spec.APIKeySecurityScheme.API_KEY; - /** * Base interface for security schemes used to authenticate access to agent endpoints. *
diff --git a/spec/src/main/java/io/a2a/spec/StringJsonrpcId.java b/spec/src/main/java/io/a2a/spec/StringJsonrpcId.java deleted file mode 100644 index 9a033a979..000000000 --- a/spec/src/main/java/io/a2a/spec/StringJsonrpcId.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.a2a.spec; - -/** - * String-based implementation of JSON-RPC request/response correlation identifier. - *
- * This class represents a JSON-RPC ID that uses a String value for correlation - * between requests and responses. According to the JSON-RPC 2.0 specification, - * String IDs are one of the valid identifier types (along with Number and NULL). - *
- * String IDs are commonly used when: - *
* This simple parameter record is used by operations that only need a task ID, - * such as {@link CancelTaskRequest}, {@link SubscribeToTaskRequest}, and similar - * task-specific requests. It optionally includes metadata for additional context. + * and similar task-specific requests. It optionally includes metadata for additional context. * * @param id the unique task identifier (required) * @param tenant optional tenant, provided as a path parameter. - * @see CancelTaskRequest for task cancellation - * @see SubscribeToTaskRequest for task resubscription * @see A2A Protocol Specification */ public record TaskIdParams(String id, String tenant) { diff --git a/spec/src/main/java/io/a2a/spec/TaskNotCancelableError.java b/spec/src/main/java/io/a2a/spec/TaskNotCancelableError.java index ad39cda16..86e7887e3 100644 --- a/spec/src/main/java/io/a2a/spec/TaskNotCancelableError.java +++ b/spec/src/main/java/io/a2a/spec/TaskNotCancelableError.java @@ -6,7 +6,7 @@ /** * A2A Protocol error indicating that a task cannot be canceled in its current state. *
- * This error is returned when a client attempts to cancel a task via {@link CancelTaskRequest} + * This error is returned when a client attempts to cancel a task * but the task is in a terminal state ({@link TaskState#COMPLETED}, {@link TaskState#FAILED}, * {@link TaskState#CANCELED}) where cancellation is not applicable. *
@@ -25,12 +25,11 @@ * } * } * - * @see CancelTaskRequest for task cancellation * @see TaskState for task state definitions * @see TaskStatus#state() for current task state * @see A2A Protocol Specification */ -public class TaskNotCancelableError extends JSONRPCError { +public class TaskNotCancelableError extends A2AError { /** * Constructs error with default message. diff --git a/spec/src/main/java/io/a2a/spec/TaskNotFoundError.java b/spec/src/main/java/io/a2a/spec/TaskNotFoundError.java index 4366db5b8..b1dd902d5 100644 --- a/spec/src/main/java/io/a2a/spec/TaskNotFoundError.java +++ b/spec/src/main/java/io/a2a/spec/TaskNotFoundError.java @@ -6,8 +6,7 @@ /** * A2A Protocol error indicating that the requested task ID does not exist. *
- * This error is returned when a client attempts to perform operations on a task (such as - * {@link GetTaskRequest}, {@link CancelTaskRequest}, or push notification operations) using + * This error is returned when a client attempts to perform operations on a task using * a task ID that is not found in the server's task store. *
* Common causes: @@ -29,11 +28,9 @@ * } * * @see Task for task object definition - * @see GetTaskRequest for task retrieval - * @see CancelTaskRequest for task cancellation * @see A2A Protocol Specification */ -public class TaskNotFoundError extends JSONRPCError { +public class TaskNotFoundError extends A2AError { /** * Constructs error with default message. diff --git a/spec/src/main/java/io/a2a/spec/TaskPushNotificationConfig.java b/spec/src/main/java/io/a2a/spec/TaskPushNotificationConfig.java index 794a29e2a..cf57a6f3c 100644 --- a/spec/src/main/java/io/a2a/spec/TaskPushNotificationConfig.java +++ b/spec/src/main/java/io/a2a/spec/TaskPushNotificationConfig.java @@ -17,7 +17,6 @@ * @param taskId the unique identifier of the task to receive push notifications for (required) * @param pushNotificationConfig the push notification endpoint and authentication configuration (required) * @see PushNotificationConfig for notification endpoint details - * @see SetTaskPushNotificationConfigRequest for setting push notifications * @see A2A Protocol Specification */ public record TaskPushNotificationConfig(String taskId, PushNotificationConfig pushNotificationConfig, @Nullable String tenant) { diff --git a/spec/src/main/java/io/a2a/spec/TaskStatusUpdateEvent.java b/spec/src/main/java/io/a2a/spec/TaskStatusUpdateEvent.java index 2a34a2e03..8dc872bba 100644 --- a/spec/src/main/java/io/a2a/spec/TaskStatusUpdateEvent.java +++ b/spec/src/main/java/io/a2a/spec/TaskStatusUpdateEvent.java @@ -1,8 +1,8 @@ package io.a2a.spec; -import com.google.gson.annotations.SerializedName; import java.util.Map; +import com.google.gson.annotations.SerializedName; import io.a2a.util.Assert; /** diff --git a/spec/src/main/java/io/a2a/spec/TextPart.java b/spec/src/main/java/io/a2a/spec/TextPart.java index 57adef574..4ab51f217 100644 --- a/spec/src/main/java/io/a2a/spec/TextPart.java +++ b/spec/src/main/java/io/a2a/spec/TextPart.java @@ -3,8 +3,6 @@ import io.a2a.util.Assert; -import static io.a2a.util.Utils.SPEC_VERSION_1_0; - /** * Represents a plain text content part within a {@link Message} or {@link Artifact}. diff --git a/spec/src/main/java/io/a2a/spec/UnsupportedOperationError.java b/spec/src/main/java/io/a2a/spec/UnsupportedOperationError.java index b4bebd1d8..da2231e30 100644 --- a/spec/src/main/java/io/a2a/spec/UnsupportedOperationError.java +++ b/spec/src/main/java/io/a2a/spec/UnsupportedOperationError.java @@ -31,7 +31,7 @@ * @see MethodNotFoundError for unknown method errors * @see A2A Protocol Specification */ -public class UnsupportedOperationError extends JSONRPCError { +public class UnsupportedOperationError extends A2AError { /** * Constructs error with all parameters. diff --git a/spec/src/main/java/io/a2a/util/Utils.java b/spec/src/main/java/io/a2a/util/Utils.java index 858737375..ca0610b1f 100644 --- a/spec/src/main/java/io/a2a/util/Utils.java +++ b/spec/src/main/java/io/a2a/util/Utils.java @@ -1,24 +1,21 @@ package io.a2a.util; +import static io.a2a.util.Assert.checkNotNullParam; + import java.util.ArrayList; import java.util.List; +import java.util.logging.Logger; import com.google.gson.Gson; -import io.a2a.json.JsonProcessingException; -import io.a2a.json.JsonUtil; import io.a2a.spec.A2AClientException; import io.a2a.spec.AgentCard; import io.a2a.spec.AgentInterface; - import io.a2a.spec.Artifact; +import io.a2a.spec.Part; import io.a2a.spec.Task; import io.a2a.spec.TaskArtifactUpdateEvent; -import io.a2a.spec.Part; -import java.util.logging.Logger; import org.jspecify.annotations.Nullable; -import static io.a2a.util.Assert.checkNotNullParam; - /** * Utility class providing common helper methods for A2A Protocol operations. *
@@ -46,21 +43,6 @@ public class Utils { */ public static final String SPEC_VERSION_1_0 = "1.0"; - /** - * Deserializes JSON string into a typed object using Gson. - *
- * This method uses the pre-configured {@link JsonUtil#fromJson(String, Class)} to parse JSON.
- *
- * @param
@@ -73,10 +55,7 @@ public static