a2a 0.1.0.pre → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.agent-docs/ROADMAP.md +423 -0
  3. data/.agent-docs/index.md +124 -0
  4. data/.agent-docs/llms.txt +318 -0
  5. data/.agent-docs/specification/json.json +2575 -0
  6. data/.agent-docs/specification.md +1924 -0
  7. data/.agent-docs/topics/a2a-and-mcp.md +132 -0
  8. data/.agent-docs/topics/agent-discovery.md +96 -0
  9. data/.agent-docs/topics/enterprise-ready.md +139 -0
  10. data/.agent-docs/topics/extensions.md +260 -0
  11. data/.agent-docs/topics/key-concepts.md +99 -0
  12. data/.agent-docs/topics/life-of-a-task.md +255 -0
  13. data/.agent-docs/topics/streaming-and-async.md +111 -0
  14. data/.agent-docs/topics/what-is-a2a.md +218 -0
  15. data/.agent-docs/tutorials/index.md +31 -0
  16. data/.agent-docs/tutorials/python/1-introduction.md +32 -0
  17. data/.agent-docs/tutorials/python/2-setup.md +55 -0
  18. data/.agent-docs/tutorials/python/3-agent-skills-and-card.md +48 -0
  19. data/.agent-docs/tutorials/python/4-agent-executor.md +57 -0
  20. data/.agent-docs/tutorials/python/5-start-server.md +55 -0
  21. data/.agent-docs/tutorials/python/6-interact-with-server.md +95 -0
  22. data/.agent-docs/tutorials/python/7-streaming-and-multiturn.md +97 -0
  23. data/.agent-docs/tutorials/python/8-next-steps.md +40 -0
  24. data/.agent-docs/types.ts +1544 -0
  25. data/.agent-docs/types_mapping.md +196 -0
  26. data/.claude/commands/gemfile/update.md +52 -0
  27. data/.claude/settings.local.json +23 -0
  28. data/.rubocop.yml +25 -4
  29. data/.tool-versions +1 -1
  30. data/CHANGELOG.md +86 -2
  31. data/CLAUDE.md +98 -0
  32. data/Guardfile +1 -1
  33. data/README.md +55 -4
  34. data/Rakefile +1 -3
  35. data/WARP.md +115 -0
  36. data/lib/a2a/extensions/additional_properties.rb +121 -0
  37. data/lib/a2a/extensions/case_transformation.rb +46 -0
  38. data/lib/a2a/extensions/json_deserialization.rb +51 -0
  39. data/lib/a2a/types/agent_capabilities.rb +18 -0
  40. data/lib/a2a/types/agent_card.rb +71 -0
  41. data/lib/a2a/types/agent_card_signature.rb +17 -0
  42. data/lib/a2a/types/agent_extension.rb +19 -0
  43. data/lib/a2a/types/agent_interface.rb +13 -0
  44. data/lib/a2a/types/agent_provider.rb +12 -0
  45. data/lib/a2a/types/agent_skill.rb +34 -0
  46. data/lib/a2a/types/api_key_security_scheme.rb +15 -0
  47. data/lib/a2a/types/artifact.rb +24 -0
  48. data/lib/a2a/types/authenticated_extended_card_not_configured_error.rb +43 -0
  49. data/lib/a2a/types/authorization_code_oauth_flow.rb +22 -0
  50. data/lib/a2a/types/cancel_task_request.rb +18 -0
  51. data/lib/a2a/types/cancel_task_response.rb +12 -0
  52. data/lib/a2a/types/client_credentials_oauth_flow.rb +16 -0
  53. data/lib/a2a/types/content_type_not_supported_error.rb +42 -0
  54. data/lib/a2a/types/data_part.rb +12 -0
  55. data/lib/a2a/types/delete_task_push_notification_config_params.rb +9 -0
  56. data/lib/a2a/types/delete_task_push_notification_config_request.rb +18 -0
  57. data/lib/a2a/types/delete_task_push_notification_config_response.rb +13 -0
  58. data/lib/a2a/types/error.rb +19 -0
  59. data/lib/a2a/types/error_codes.rb +32 -0
  60. data/lib/a2a/types/file_base.rb +12 -0
  61. data/lib/a2a/types/file_part.rb +13 -0
  62. data/lib/a2a/types/file_with_bytes.rb +9 -0
  63. data/lib/a2a/types/file_with_uri.rb +9 -0
  64. data/lib/a2a/types/get_authenticated_extended_card_request.rb +15 -0
  65. data/lib/a2a/types/get_authenticated_extended_card_response.rb +13 -0
  66. data/lib/a2a/types/get_task_push_notification_config_params.rb +9 -0
  67. data/lib/a2a/types/get_task_push_notification_config_request.rb +21 -0
  68. data/lib/a2a/types/get_task_push_notification_request.rb +18 -0
  69. data/lib/a2a/types/get_task_push_notification_response.rb +12 -0
  70. data/lib/a2a/types/get_task_request.rb +18 -0
  71. data/lib/a2a/types/get_task_response.rb +12 -0
  72. data/lib/a2a/types/http_auth_security_scheme.rb +18 -0
  73. data/lib/a2a/types/implicit_oauth_flow.rb +16 -0
  74. data/lib/a2a/types/invalid_agent_response_error.rb +41 -0
  75. data/lib/a2a/types/list_task_push_notification_config_params.rb +8 -0
  76. data/lib/a2a/types/list_task_push_notification_config_request.rb +18 -0
  77. data/lib/a2a/types/list_task_push_notification_config_response.rb +13 -0
  78. data/lib/a2a/types/message.rb +35 -0
  79. data/lib/a2a/types/message_send_configuration.rb +20 -0
  80. data/lib/a2a/types/message_send_params.rb +16 -0
  81. data/lib/a2a/types/mutual_tls_security_scheme.rb +9 -0
  82. data/lib/a2a/types/oauth2_security_scheme.rb +16 -0
  83. data/lib/a2a/types/oauth_flows.rb +20 -0
  84. data/lib/a2a/types/openid_connect_security_scheme.rb +12 -0
  85. data/lib/a2a/types/part.rb +7 -0
  86. data/lib/a2a/types/part_base.rb +9 -0
  87. data/lib/a2a/types/password_oauth_flow.rb +16 -0
  88. data/lib/a2a/types/protocol_struct.rb +12 -0
  89. data/lib/a2a/types/push_notification_authentication_info.rb +12 -0
  90. data/lib/a2a/types/push_notification_config.rb +20 -0
  91. data/lib/a2a/types/push_notification_not_supported_error.rb +42 -0
  92. data/lib/a2a/types/request.rb +15 -0
  93. data/lib/a2a/types/security_scheme.rb +11 -0
  94. data/lib/a2a/types/security_scheme_base.rb +9 -0
  95. data/lib/a2a/types/send_message_request.rb +18 -0
  96. data/lib/a2a/types/send_message_response.rb +13 -0
  97. data/lib/a2a/types/send_streaming_message_request.rb +18 -0
  98. data/lib/a2a/types/send_streaming_message_response.rb +15 -0
  99. data/lib/a2a/types/set_task_push_notification_config_request.rb +18 -0
  100. data/lib/a2a/types/set_task_push_notification_request.rb +18 -0
  101. data/lib/a2a/types/set_task_push_notification_response.rb +12 -0
  102. data/lib/a2a/types/task.rb +29 -0
  103. data/lib/a2a/types/task_artifact_update_event.rb +29 -0
  104. data/lib/a2a/types/task_id_params.rb +12 -0
  105. data/lib/a2a/types/task_not_cancelable_error.rb +42 -0
  106. data/lib/a2a/types/task_not_found_error.rb +42 -0
  107. data/lib/a2a/types/task_push_notification_config.rb +12 -0
  108. data/lib/a2a/types/task_query_params.rb +9 -0
  109. data/lib/a2a/types/task_resubscription_request.rb +18 -0
  110. data/lib/a2a/types/task_state.rb +7 -0
  111. data/lib/a2a/types/task_status.rb +15 -0
  112. data/lib/a2a/types/task_status_update_event.rb +25 -0
  113. data/lib/a2a/types/text_part.rb +12 -0
  114. data/lib/a2a/types/transport_protocol.rb +6 -0
  115. data/lib/a2a/types/unsupported_operation_error.rb +42 -0
  116. data/lib/a2a/types.rb +25 -0
  117. data/lib/a2a/version.rb +1 -1
  118. data/lib/a2a.rb +30 -1
  119. metadata +128 -299
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines configuration details for the OAuth 2.0 Client Credentials flow.
5
+ class ClientCredentialsOAuthFlow < ProtocolStruct
6
+ # @return [URI] The token URL to be used for this flow. This MUST be a URL.
7
+ attribute :token_url, Types::URI
8
+
9
+ # @return [URI, nil] The URL to be used for obtaining refresh tokens. This MUST be a URL.
10
+ attribute? :refresh_url, Types::URI.optional
11
+
12
+ # @return [Hash] The available scopes for the OAuth2 security scheme. A map between the scope
13
+ # name and a short description for it.
14
+ attribute :scopes, Types::Hash.map(Types::String, Types::String)
15
+ end
16
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Error for unsupported content types (-32005)
5
+ #
6
+ # Raised when a Media Type provided in the request's message.parts (or implied for an artifact)
7
+ # is not supported by the agent or the specific skill being invoked.
8
+ #
9
+ # @api public
10
+ #
11
+ # @example Create a content type not supported error
12
+ # error = JSONRPC::ContentTypeNotSupportedError.new
13
+ #
14
+ class ContentTypeNotSupportedError < JSONRPC::Error
15
+ # Creates a new Content Type Not Supported Error with code -32005
16
+ #
17
+ # @api public
18
+ #
19
+ # @example Create a content type not supported error with default message
20
+ # error = JSONRPC::ContentTypeNotSupportedError.new
21
+ #
22
+ # @example Create a content type not supported error with exception details
23
+ # error = JSONRPC::ContentTypeNotSupportedError.new(data: { content_type: 'application/xml' }, request_id: 1)
24
+ #
25
+ # @param message [String] short description of the error
26
+ # @param data [Hash, Array, String, Number, Boolean, nil] additional error information
27
+ # @param request_id [String, Integer, nil] the request identifier
28
+ #
29
+ def initialize(
30
+ message = 'Incompatible content types.',
31
+ data: nil,
32
+ request_id: nil
33
+ )
34
+ super(
35
+ message,
36
+ code: ErrorCodes::CONTENT_TYPE_NOT_SUPPORTED,
37
+ data:,
38
+ request_id:
39
+ )
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a structured data segment (e.g., JSON) within a message or artifact.
5
+ class DataPart < PartBase
6
+ # @return [String] The type of this part, used as a discriminator. Always 'data'.
7
+ attribute :kind, Types::String.constant('data')
8
+
9
+ # @return [Hash] The structured data content.
10
+ attribute :data, Types::Hash
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines parameters for deleting a specific push notification configuration for a task.
5
+ class DeleteTaskPushNotificationConfigParams < TaskIdParams
6
+ # @return [String] The ID of the push notification configuration to delete.
7
+ attribute :push_notification_config_id, Types::String
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a JSON-RPC request for the `tasks/pushNotificationConfig/delete` method.
5
+ class DeleteTaskPushNotificationConfigRequest < JSONRPC::Request
6
+ # @return [String] Method name for deleting push notification configurations.
7
+ METHOD = 'tasks/pushNotificationConfig/delete'
8
+
9
+ # @return [String] Method name for deleting push notification configurations.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [DeleteTaskPushNotificationConfigParams] Parameters for deleting push notification configurations.
13
+ attribute :params, Types::Constructor(DeleteTaskPushNotificationConfigParams)
14
+
15
+ # @return [String] Method name for deleting push notification configurations.
16
+ def method = attributes[:method]
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Response to a `tasks/pushNotificationConfig/delete` request.
5
+ # Returns null on successful deletion.
6
+ class DeleteTaskPushNotificationConfigResponse < JSONRPC::Response
7
+ # @return [NilClass, nil] Returns null on successful deletion.
8
+ attribute? :result, Types::Nil.optional
9
+
10
+ # @return [JSONRPC::Error, nil] Error information if the request failed.
11
+ attribute? :error, Types::Constructor(JSONRPC::Error).optional
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # A discriminated union of all standard JSON-RPC and A2A-specific error types.
5
+ Error = Types.Constructor(
6
+ Types.Instance(JSONRPC::ParseError) |
7
+ Types.Instance(JSONRPC::InvalidRequestError) |
8
+ Types.Instance(JSONRPC::MethodNotFoundError) |
9
+ Types.Instance(JSONRPC::InvalidParamsError) |
10
+ Types.Instance(JSONRPC::InternalError) |
11
+ Types.Instance(TaskNotFoundError) |
12
+ Types.Instance(TaskNotCancelableError) |
13
+ Types.Instance(PushNotificationNotSupportedError) |
14
+ Types.Instance(UnsupportedOperationError) |
15
+ Types.Instance(ContentTypeNotSupportedError) |
16
+ Types.Instance(InvalidAgentResponseError) |
17
+ Types.Instance(AuthenticatedExtendedCardNotConfiguredError)
18
+ ) { |value| value }
19
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Standard JSON-RPC error codes
5
+ module ErrorCodes
6
+ # Invalid JSON was received by the server
7
+ PARSE_ERROR = -32_700
8
+ # The JSON sent is not a valid Request object
9
+ INVALID_REQUEST = -32_600
10
+ # The method does not exist / is not available
11
+ METHOD_NOT_FOUND = -32_601
12
+ # Invalid method parameter(s)
13
+ INVALID_PARAMS = -32_602
14
+ # Internal JSON-RPC error
15
+ INTERNAL_ERROR = -32_603
16
+
17
+ # The specified task was not found
18
+ TASK_NOT_FOUND = -32_001
19
+ # The specified task cannot be canceled
20
+ TASK_NOT_CANCELABLE = -32_002
21
+ # Push Notifications are not supported for this operation or agent
22
+ PUSH_NOTIFICATION_NOT_SUPPORTED = -32_003
23
+ # The requested operation is not supported by the agent
24
+ UNSUPPORTED_OPERATION = -32_004
25
+ # Content type is not supported
26
+ CONTENT_TYPE_NOT_SUPPORTED = -32_005
27
+ # Invalid agent response type
28
+ INVALID_AGENT_RESPONSE = -32_006
29
+ # Authenticated Extended Card not configured
30
+ AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED = -32_007
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines base properties for a file.
5
+ class FileBase < ProtocolStruct
6
+ # @return [String, nil] An optional name for the file (e.g., "document.pdf").
7
+ attribute? :name, Types::String.optional
8
+
9
+ # @return [String, nil] The MIME type of the file (e.g., "application/pdf").
10
+ attribute? :mime_type, Types::String.optional
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a file segment within a message or artifact. The file content can be
5
+ # provided either directly as bytes or as a URI.
6
+ class FilePart < PartBase
7
+ # @return [String] The type of this part, used as a discriminator. Always 'file'.
8
+ attribute :kind, Types::String.constant('file')
9
+
10
+ # @return [FileWithBytes | FileWithUri] The file content, represented as either a URI or as base64-encoded bytes.
11
+ attribute :file, Types::Constructor(FileWithBytes | FileWithUri)
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a file with its content provided directly as a base64-encoded string.
5
+ class FileWithBytes < FileBase
6
+ # @return [String] The base64-encoded content of the file.
7
+ attribute :bytes, Types::String
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a file with its content located at a specific URI.
5
+ class FileWithUri < FileBase
6
+ # @return [URI] A URL pointing to the file's content.
7
+ attribute :uri, Types::URI
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a JSON-RPC request for the `agent/getAuthenticatedExtendedCard` method.
5
+ class GetAuthenticatedExtendedCardRequest < JSONRPC::Request
6
+ # @return [String] Method name for getting authenticated extended card.
7
+ METHOD = 'agent/getAuthenticatedExtendedCard'
8
+
9
+ # @return [String] Method name for getting authenticated extended card.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [String] Method name for getting authenticated extended card.
13
+ def method = attributes[:method]
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Response to a `agent/getAuthenticatedExtendedCard` request.
5
+ # Returns an extended AgentCard with additional details for authenticated users.
6
+ class GetAuthenticatedExtendedCardResponse < JSONRPC::Response
7
+ # @return [AgentCard, nil] The authenticated extended agent card if successful.
8
+ attribute? :result, Types::Constructor(AgentCard).optional
9
+
10
+ # @return [JSONRPC::Error, nil] Error information if the request failed.
11
+ attribute? :error, Types::Constructor(JSONRPC::Error).optional
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines parameters for fetching a specific push notification configuration for a task.
5
+ class GetTaskPushNotificationConfigParams < TaskIdParams
6
+ # @return [String, nil] The ID of the push notification configuration to retrieve.
7
+ attribute? :push_notification_config_id, Types::String.optional
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a JSON-RPC request for the `tasks/pushNotificationConfig/get` method.
5
+ class GetTaskPushNotificationConfigRequest < JSONRPC::Request
6
+ # @return [String] Method name for getting task push notification configuration.
7
+ METHOD = 'tasks/pushNotificationConfig/get'
8
+
9
+ # @return [String] Method name for getting task push notification configuration.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [GetTaskPushNotificationConfigParams, TaskIdParams] Parameters for getting a push notification
13
+ # configuration. The TaskIdParams type is deprecated for this method. Use GetTaskPushNotificationConfigParams
14
+ # instead.
15
+ attribute :params,
16
+ Types::Constructor(GetTaskPushNotificationConfigParams) | Types::Constructor(TaskIdParams)
17
+
18
+ # @return [String] Method name for getting task push notification configuration.
19
+ def method = attributes[:method]
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Request to retrieve the currently configured push notification configuration for a task.
5
+ class GetTaskPushNotificationRequest < JSONRPC::Request
6
+ # @return [String] Method name for getting task notification configuration.
7
+ METHOD = 'tasks/pushNotificationConfig/get'
8
+
9
+ # @return [String] Method name for getting task notification configuration.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [TaskIdParams] Parameters for the get task push notification config method.
13
+ attribute :params, Types::Constructor(TaskIdParams)
14
+
15
+ # @return [String] Method name for getting task notification configuration.
16
+ def method = attributes[:method]
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Response to a `tasks/pushNotificationConfig/get` request. Contains the TaskPushNotificationConfig or an error.
5
+ class GetTaskPushNotificationResponse < JSONRPC::Response
6
+ # @return [TaskPushNotificationConfig, nil] The push notification config if successful.
7
+ attribute? :result, Types::Constructor(TaskPushNotificationConfig).optional
8
+
9
+ # @return [JSONRPC::Error, nil] Error information if the request failed.
10
+ attribute? :error, Types::Constructor(JSONRPC::Error).optional
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Request to retrieve the current state of a task.
5
+ class GetTaskRequest < JSONRPC::Request
6
+ # @return [String] Method name for getting task status.
7
+ METHOD = 'tasks/get'
8
+
9
+ # @return [String] Method name for getting task status.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [TaskQueryParams] Parameters for the get task method.
13
+ attribute :params, Types::Constructor(TaskQueryParams)
14
+
15
+ # @return [String] Method name for getting task status.
16
+ def method = attributes[:method]
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Response to a `tasks/get` request. Contains the Task object or an error.
5
+ class GetTaskResponse < JSONRPC::Response
6
+ # @return [Task, nil] The task information if successful.
7
+ attribute? :result, Types::Constructor(Task).optional
8
+
9
+ # @return [JSONRPC::Error, nil] Error information if the request failed.
10
+ attribute? :error, Types::Constructor(JSONRPC::Error).optional
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines a security scheme using HTTP authentication.
5
+ class HTTPAuthSecurityScheme < SecuritySchemeBase
6
+ # @return [String] The type of the security scheme. Must be 'http'.
7
+ attribute :type, Types::String.constant('http')
8
+
9
+ # @return [String] The name of the HTTP Authentication scheme to be used in the Authorization header,
10
+ # as defined in RFC7235 (e.g., "Bearer").
11
+ # This value should be registered in the IANA Authentication Scheme registry.
12
+ attribute :scheme, Types::String
13
+
14
+ # @return [String, nil] A hint to the client to identify how the bearer token is formatted (e.g., "JWT").
15
+ # This is primarily for documentation purposes.
16
+ attribute? :bearer_format, Types::String.optional
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines configuration details for the OAuth 2.0 Implicit flow.
5
+ class ImplicitOAuthFlow < ProtocolStruct
6
+ # @return [URI] The authorization URL to be used for this flow. This MUST be a URL.
7
+ attribute :authorization_url, Types::URI
8
+
9
+ # @return [URI, nil] The URL to be used for obtaining refresh tokens. This MUST be a URL.
10
+ attribute? :refresh_url, Types::URI.optional
11
+
12
+ # @return [Hash] The available scopes for the OAuth2 security scheme. A map between the scope
13
+ # name and a short description for it.
14
+ attribute :scopes, Types::Hash.map(Types::String, Types::String)
15
+ end
16
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Error for invalid agent responses (-32006)
5
+ #
6
+ # Raised when agent generates an invalid response for the requested method.
7
+ #
8
+ # @api public
9
+ #
10
+ # @example Create an invalid agent response error
11
+ # error = JSONRPC::InvalidAgentResponseError.new
12
+ #
13
+ class InvalidAgentResponseError < JSONRPC::Error
14
+ # Creates a new Invalid Agent Response Error with code -32006
15
+ #
16
+ # @api public
17
+ #
18
+ # @example Create an invalid agent response error with default message
19
+ # error = JSONRPC::InvalidAgentResponseError.new
20
+ #
21
+ # @example Create an invalid agent response error with exception details
22
+ # error = JSONRPC::InvalidAgentResponseError.new(data: { response_type: 'malformed' }, request_id: 1)
23
+ #
24
+ # @param message [String] short description of the error
25
+ # @param data [Hash, Array, String, Number, Boolean, nil] additional error information
26
+ # @param request_id [String, Integer, nil] the request identifier
27
+ #
28
+ def initialize(
29
+ message = 'Invalid agent response type.',
30
+ data: nil,
31
+ request_id: nil
32
+ )
33
+ super(
34
+ message,
35
+ code: ErrorCodes::INVALID_AGENT_RESPONSE,
36
+ data:,
37
+ request_id:
38
+ )
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines parameters for listing all push notification configurations associated with a task.
5
+ class ListTaskPushNotificationConfigParams < TaskIdParams
6
+ # No additional attributes beyond those inherited from TaskIdParams
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a JSON-RPC request for the `tasks/pushNotificationConfig/list` method.
5
+ class ListTaskPushNotificationConfigRequest < JSONRPC::Request
6
+ # @return [String] Method name for listing push notification configurations.
7
+ METHOD = 'tasks/pushNotificationConfig/list'
8
+
9
+ # @return [String] Method name for listing push notification configurations.
10
+ attribute :method, Types::String.constant(METHOD)
11
+
12
+ # @return [ListTaskPushNotificationConfigParams] Parameters for listing push notification configurations.
13
+ attribute :params, Types::Constructor(ListTaskPushNotificationConfigParams)
14
+
15
+ # @return [String] Method name for listing push notification configurations.
16
+ def method = attributes[:method]
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Response to a `tasks/pushNotificationConfig/list` request.
5
+ # Returns an array of all push notification configurations for the specified task.
6
+ class ListTaskPushNotificationConfigResponse < JSONRPC::Response
7
+ # @return [Array<TaskPushNotificationConfig>, nil] Array of push notification configurations if successful.
8
+ attribute? :result, Types::Array.of(Types::Constructor(TaskPushNotificationConfig)).optional
9
+
10
+ # @return [JSONRPC::Error, nil] Error information if the request failed.
11
+ attribute? :error, Types::Constructor(JSONRPC::Error).optional
12
+ end
13
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Represents a single message in the conversation between a user and an agent.
5
+ class Message < ProtocolStruct
6
+ # @return [String] Identifies the sender of the message. `user` for the client, `agent` for the service.
7
+ attribute :role, Types::String.enum('user', 'agent')
8
+
9
+ # @return [Array<Part>] An array of content parts that form the message body. A message can be
10
+ # composed of multiple parts of different types (e.g., text and files).
11
+ attribute :parts, Types::Array.of(Types::Constructor(Part))
12
+
13
+ # @return [Hash, nil] Optional metadata for extensions. The key is an extension-specific identifier.
14
+ attribute? :metadata, Types::Hash.optional
15
+
16
+ # @return [Array<String>, nil] The URIs of extensions that are relevant to this message.
17
+ attribute? :extensions, Types::Array.of(Types::String).optional
18
+
19
+ # @return [Array<String>, nil] A list of other task IDs that this message references for additional context.
20
+ attribute? :reference_task_ids, Types::Array.of(Types::String).optional
21
+
22
+ # @return [String] A unique identifier for the message, typically a UUID, generated by the sender.
23
+ attribute :message_id, Types::String
24
+
25
+ # @return [String, nil] The ID of the task this message is part of. Can be omitted for the first message of a
26
+ # new task.
27
+ attribute? :task_id, Types::String.optional
28
+
29
+ # @return [String, nil] The context ID for this message, used to group related interactions.
30
+ attribute? :context_id, Types::String.optional
31
+
32
+ # @return [String] The type of this object, used as a discriminator. Always 'message' for a Message.
33
+ attribute :kind, Types::String.constant('message')
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines configuration options for a `message/send` or `message/stream` request.
5
+ class MessageSendConfiguration < ProtocolStruct
6
+ # @return [Array<String>, nil] A list of output MIME types the client is prepared to accept in the response.
7
+ attribute? :accepted_output_modes, Types::Array.of(Types::String).optional
8
+
9
+ # @return [Integer, nil] The number of most recent messages from the task's history to retrieve in the response.
10
+ attribute? :history_length, Types::Integer.optional
11
+
12
+ # @return [PushNotificationConfig, nil] Configuration for the agent to send push notifications for updates after
13
+ # the initial response.
14
+ attribute? :push_notification_config, Types::Constructor(PushNotificationConfig).optional
15
+
16
+ # @return [Boolean] If true, the client will wait for the task to complete. The server may reject this if
17
+ # the task is long-running.
18
+ attribute? :blocking, Types::Bool.default(false)
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines the parameters for a request to send a message to an agent. This can be used
5
+ # to create a new task, continue an existing one, or restart a task.
6
+ class MessageSendParams < ProtocolStruct
7
+ # @return [Message] The message object being sent to the agent.
8
+ attribute :message, Types::Constructor(Message)
9
+
10
+ # @return [MessageSendConfiguration, nil] Optional configuration for the send request.
11
+ attribute? :configuration, Types::Constructor(MessageSendConfiguration).optional
12
+
13
+ # @return [Hash, nil] Optional metadata for extensions.
14
+ attribute? :metadata, Types::Hash.optional
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines a security scheme using mTLS authentication.
5
+ class MutualTLSSecurityScheme < SecuritySchemeBase
6
+ # @return [String] The type of the security scheme. Must be 'mutualTLS'.
7
+ attribute :type, Types::String.constant('mutualTLS')
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines a security scheme using OAuth 2.0.
5
+ class OAuth2SecurityScheme < SecuritySchemeBase
6
+ # @return [String] The type of the security scheme. Must be 'oauth2'.
7
+ attribute :type, Types::String.constant('oauth2')
8
+
9
+ # @return [OAuthFlows] An object containing configuration information for the supported OAuth 2.0 flows.
10
+ attribute :flows, Types::Constructor(OAuthFlows)
11
+
12
+ # @return [URI, nil] URL to the oauth2 authorization server metadata
13
+ # RFC8414. TLS is required.
14
+ attribute? :oauth2_metadata_url, Types::URI.optional
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines the configuration for the supported OAuth 2.0 flows.
5
+ class OAuthFlows < ProtocolStruct
6
+ # @return [AuthorizationCodeOAuthFlow, nil] Configuration for the OAuth Authorization Code flow.
7
+ # Previously called accessCode in OpenAPI 2.0.
8
+ attribute? :authorization_code, Types::Constructor(AuthorizationCodeOAuthFlow).optional
9
+
10
+ # @return [ClientCredentialsOAuthFlow, nil] Configuration for the OAuth Client Credentials flow.
11
+ # Previously called application in OpenAPI 2.0.
12
+ attribute? :client_credentials, Types::Constructor(ClientCredentialsOAuthFlow).optional
13
+
14
+ # @return [ImplicitOAuthFlow, nil] Configuration for the OAuth Implicit flow.
15
+ attribute? :implicit, Types::Constructor(ImplicitOAuthFlow).optional
16
+
17
+ # @return [PasswordOAuthFlow, nil] Configuration for the OAuth Resource Owner Password flow.
18
+ attribute? :password, Types::Constructor(PasswordOAuthFlow).optional
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines a security scheme using OpenID Connect.
5
+ class OpenIdConnectSecurityScheme < SecuritySchemeBase
6
+ # @return [String] The type of the security scheme. Must be 'openIdConnect'.
7
+ attribute :type, Types::String.constant('openIdConnect')
8
+
9
+ # @return [URI] The OpenID Connect Discovery URL for the OIDC provider's metadata.
10
+ attribute :open_id_connect_url, Types::URI
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # A discriminated union representing a part of a message or artifact, which can
5
+ # be text, a file, or structured data.
6
+ Part = TextPart | FilePart | DataPart
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines base properties common to all message or artifact parts.
5
+ class PartBase < ProtocolStruct
6
+ # @return [Hash<String, Object>] Optional metadata associated with this part.
7
+ attribute? :metadata, Types::Hash.map(Types::String, Types::Any).optional
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ # Defines configuration details for the OAuth 2.0 Resource Owner Password flow.
5
+ class PasswordOAuthFlow < ProtocolStruct
6
+ # @return [URI] The token URL to be used for this flow. This MUST be a URL.
7
+ attribute :token_url, Types::URI
8
+
9
+ # @return [URI, nil] The URL to be used for obtaining refresh tokens. This MUST be a URL.
10
+ attribute? :refresh_url, Types::URI.optional
11
+
12
+ # @return [Hash] The available scopes for the OAuth2 security scheme. A map between the scope
13
+ # name and a short description for it.
14
+ attribute :scopes, Types::Hash.map(Types::String, Types::String)
15
+ end
16
+ end