a2a 0.1.0 → 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.
- checksums.yaml +4 -4
- data/.agent-docs/ROADMAP.md +423 -0
- data/.agent-docs/index.md +124 -0
- data/.agent-docs/llms.txt +318 -0
- data/.agent-docs/specification/json.json +2575 -0
- data/.agent-docs/specification.md +1924 -0
- data/.agent-docs/topics/a2a-and-mcp.md +132 -0
- data/.agent-docs/topics/agent-discovery.md +96 -0
- data/.agent-docs/topics/enterprise-ready.md +139 -0
- data/.agent-docs/topics/extensions.md +260 -0
- data/.agent-docs/topics/key-concepts.md +99 -0
- data/.agent-docs/topics/life-of-a-task.md +255 -0
- data/.agent-docs/topics/streaming-and-async.md +111 -0
- data/.agent-docs/topics/what-is-a2a.md +218 -0
- data/.agent-docs/tutorials/index.md +31 -0
- data/.agent-docs/tutorials/python/1-introduction.md +32 -0
- data/.agent-docs/tutorials/python/2-setup.md +55 -0
- data/.agent-docs/tutorials/python/3-agent-skills-and-card.md +48 -0
- data/.agent-docs/tutorials/python/4-agent-executor.md +57 -0
- data/.agent-docs/tutorials/python/5-start-server.md +55 -0
- data/.agent-docs/tutorials/python/6-interact-with-server.md +95 -0
- data/.agent-docs/tutorials/python/7-streaming-and-multiturn.md +97 -0
- data/.agent-docs/tutorials/python/8-next-steps.md +40 -0
- data/.agent-docs/types.ts +1544 -0
- data/.agent-docs/types_mapping.md +196 -0
- data/.claude/commands/gemfile/update.md +52 -0
- data/.claude/settings.local.json +23 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +68 -1
- data/CLAUDE.md +98 -0
- data/README.md +20 -14
- data/Rakefile +1 -3
- data/WARP.md +115 -0
- data/lib/a2a/extensions/json_deserialization.rb +1 -3
- data/lib/a2a/types/agent_capabilities.rb +3 -0
- data/lib/a2a/types/agent_card.rb +49 -17
- data/lib/a2a/types/agent_card_signature.rb +17 -0
- data/lib/a2a/types/agent_extension.rb +19 -0
- data/lib/a2a/types/agent_interface.rb +13 -0
- data/lib/a2a/types/agent_provider.rb +2 -2
- data/lib/a2a/types/agent_skill.rb +11 -4
- data/lib/a2a/types/api_key_security_scheme.rb +15 -0
- data/lib/a2a/types/artifact.rb +10 -15
- data/lib/a2a/types/authenticated_extended_card_not_configured_error.rb +43 -0
- data/lib/a2a/types/authorization_code_oauth_flow.rb +22 -0
- data/lib/a2a/types/cancel_task_request.rb +5 -2
- data/lib/a2a/types/cancel_task_response.rb +3 -3
- data/lib/a2a/types/client_credentials_oauth_flow.rb +16 -0
- data/lib/a2a/types/content_type_not_supported_error.rb +42 -0
- data/lib/a2a/types/data_part.rb +5 -8
- data/lib/a2a/types/delete_task_push_notification_config_params.rb +9 -0
- data/lib/a2a/types/delete_task_push_notification_config_request.rb +18 -0
- data/lib/a2a/types/delete_task_push_notification_config_response.rb +13 -0
- data/lib/a2a/types/error.rb +19 -0
- data/lib/a2a/types/error_codes.rb +6 -0
- data/lib/a2a/types/file_base.rb +12 -0
- data/lib/a2a/types/file_part.rb +7 -9
- data/lib/a2a/types/file_with_bytes.rb +9 -0
- data/lib/a2a/types/file_with_uri.rb +9 -0
- data/lib/a2a/types/get_authenticated_extended_card_request.rb +15 -0
- data/lib/a2a/types/get_authenticated_extended_card_response.rb +13 -0
- data/lib/a2a/types/get_task_push_notification_config_params.rb +9 -0
- data/lib/a2a/types/get_task_push_notification_config_request.rb +21 -0
- data/lib/a2a/types/get_task_push_notification_request.rb +5 -2
- data/lib/a2a/types/get_task_push_notification_response.rb +4 -4
- data/lib/a2a/types/get_task_request.rb +5 -2
- data/lib/a2a/types/get_task_response.rb +3 -3
- data/lib/a2a/types/http_auth_security_scheme.rb +18 -0
- data/lib/a2a/types/implicit_oauth_flow.rb +16 -0
- data/lib/a2a/types/invalid_agent_response_error.rb +41 -0
- data/lib/a2a/types/list_task_push_notification_config_params.rb +8 -0
- data/lib/a2a/types/list_task_push_notification_config_request.rb +18 -0
- data/lib/a2a/types/list_task_push_notification_config_response.rb +13 -0
- data/lib/a2a/types/message.rb +24 -4
- data/lib/a2a/types/message_send_configuration.rb +20 -0
- data/lib/a2a/types/message_send_params.rb +16 -0
- data/lib/a2a/types/mutual_tls_security_scheme.rb +9 -0
- data/lib/a2a/types/oauth2_security_scheme.rb +16 -0
- data/lib/a2a/types/oauth_flows.rb +20 -0
- data/lib/a2a/types/openid_connect_security_scheme.rb +12 -0
- data/lib/a2a/types/part.rb +2 -1
- data/lib/a2a/types/part_base.rb +9 -0
- data/lib/a2a/types/password_oauth_flow.rb +16 -0
- data/lib/a2a/types/push_notification_authentication_info.rb +12 -0
- data/lib/a2a/types/push_notification_config.rb +11 -6
- data/lib/a2a/types/push_notification_not_supported_error.rb +37 -10
- data/lib/a2a/types/request.rb +15 -0
- data/lib/a2a/types/security_scheme.rb +11 -0
- data/lib/a2a/types/security_scheme_base.rb +9 -0
- data/lib/a2a/types/send_message_request.rb +18 -0
- data/lib/a2a/types/send_message_response.rb +13 -0
- data/lib/a2a/types/send_streaming_message_request.rb +18 -0
- data/lib/a2a/types/send_streaming_message_response.rb +15 -0
- data/lib/a2a/types/set_task_push_notification_config_request.rb +18 -0
- data/lib/a2a/types/set_task_push_notification_request.rb +5 -2
- data/lib/a2a/types/set_task_push_notification_response.rb +4 -4
- data/lib/a2a/types/task.rb +15 -11
- data/lib/a2a/types/task_artifact_update_event.rb +18 -7
- data/lib/a2a/types/task_not_cancelable_error.rb +37 -10
- data/lib/a2a/types/task_not_found_error.rb +37 -10
- data/lib/a2a/types/task_resubscription_request.rb +5 -2
- data/lib/a2a/types/task_state.rb +2 -1
- data/lib/a2a/types/task_status_update_event.rb +13 -6
- data/lib/a2a/types/text_part.rb +5 -8
- data/lib/a2a/types/transport_protocol.rb +6 -0
- data/lib/a2a/types/unsupported_operation_error.rb +37 -10
- data/lib/a2a/types.rb +13 -0
- data/lib/a2a/version.rb +1 -1
- data/lib/a2a.rb +15 -5
- metadata +101 -19
- data/lib/a2a/types/agent_authentication.rb +0 -13
- data/lib/a2a/types/authentication_info.rb +0 -9
- data/lib/a2a/types/file_content.rb +0 -18
- data/lib/a2a/types/internal_error.rb +0 -15
- data/lib/a2a/types/invalid_params_error.rb +0 -15
- data/lib/a2a/types/invalid_request_error.rb +0 -15
- data/lib/a2a/types/json_parse_error.rb +0 -15
- data/lib/a2a/types/jsonrpc_error.rb +0 -15
- data/lib/a2a/types/jsonrpc_message.rb +0 -12
- data/lib/a2a/types/jsonrpc_request.rb +0 -15
- data/lib/a2a/types/jsonrpc_response.rb +0 -12
- data/lib/a2a/types/method_not_found_error.rb +0 -15
- data/lib/a2a/types/send_task_request.rb +0 -15
- data/lib/a2a/types/send_task_response.rb +0 -13
- data/lib/a2a/types/send_task_streaming_request.rb +0 -15
- data/lib/a2a/types/send_task_streaming_response.rb +0 -15
- data/lib/a2a/types/task_send_params.rb +0 -26
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Response to a `tasks/
|
5
|
-
class GetTaskPushNotificationResponse <
|
4
|
+
# Response to a `tasks/pushNotificationConfig/get` request. Contains the TaskPushNotificationConfig or an error.
|
5
|
+
class GetTaskPushNotificationResponse < JSONRPC::Response
|
6
6
|
# @return [TaskPushNotificationConfig, nil] The push notification config if successful.
|
7
7
|
attribute? :result, Types::Constructor(TaskPushNotificationConfig).optional
|
8
8
|
|
9
|
-
# @return [
|
10
|
-
attribute? :error, Types::Constructor(
|
9
|
+
# @return [JSONRPC::Error, nil] Error information if the request failed.
|
10
|
+
attribute? :error, Types::Constructor(JSONRPC::Error).optional
|
11
11
|
end
|
12
12
|
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Request to retrieve the current state of a task.
|
5
|
-
class GetTaskRequest <
|
5
|
+
class GetTaskRequest < JSONRPC::Request
|
6
6
|
# @return [String] Method name for getting task status.
|
7
|
-
|
7
|
+
METHOD = 'tasks/get'
|
8
|
+
|
9
|
+
# @return [String] Method name for getting task status.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
8
11
|
|
9
12
|
# @return [TaskQueryParams] Parameters for the get task method.
|
10
13
|
attribute :params, Types::Constructor(TaskQueryParams)
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Response to a `tasks/get` request. Contains the Task object or an error.
|
5
|
-
class GetTaskResponse <
|
5
|
+
class GetTaskResponse < JSONRPC::Response
|
6
6
|
# @return [Task, nil] The task information if successful.
|
7
7
|
attribute? :result, Types::Constructor(Task).optional
|
8
8
|
|
9
|
-
# @return [
|
10
|
-
attribute? :error, Types::Constructor(
|
9
|
+
# @return [JSONRPC::Error, nil] Error information if the request failed.
|
10
|
+
attribute? :error, Types::Constructor(JSONRPC::Error).optional
|
11
11
|
end
|
12
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
|
data/lib/a2a/types/message.rb
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Represents a message
|
4
|
+
# Represents a single message in the conversation between a user and an agent.
|
5
5
|
class Message < ProtocolStruct
|
6
|
-
# @return [String]
|
6
|
+
# @return [String] Identifies the sender of the message. `user` for the client, `agent` for the service.
|
7
7
|
attribute :role, Types::String.enum('user', 'agent')
|
8
8
|
|
9
|
-
# @return [Array<Part>]
|
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).
|
10
11
|
attribute :parts, Types::Array.of(Types::Constructor(Part))
|
11
12
|
|
12
|
-
# @return [Hash, nil] Optional metadata
|
13
|
+
# @return [Hash, nil] Optional metadata for extensions. The key is an extension-specific identifier.
|
13
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')
|
14
34
|
end
|
15
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
|
data/lib/a2a/types/part.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
#
|
4
|
+
# A discriminated union representing a part of a message or artifact, which can
|
5
|
+
# be text, a file, or structured data.
|
5
6
|
Part = TextPart | FilePart | DataPart
|
6
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Defines authentication details for a push notification endpoint.
|
5
|
+
class PushNotificationAuthenticationInfo < ProtocolStruct
|
6
|
+
# @return [Array<String>] A list of supported authentication schemes (e.g., 'Basic', 'Bearer').
|
7
|
+
attribute :schemes, Types::Array.of(Types::String)
|
8
|
+
|
9
|
+
# @return [String, nil] Optional credentials required by the push notification endpoint.
|
10
|
+
attribute? :credentials, Types::String.optional
|
11
|
+
end
|
12
|
+
end
|
@@ -1,15 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
#
|
4
|
+
# Defines the configuration for setting up push notifications for task updates.
|
5
5
|
class PushNotificationConfig < ProtocolStruct
|
6
|
-
# @return [String]
|
7
|
-
|
6
|
+
# @return [String, nil] A unique identifier (e.g. UUID) for the push notification configuration, set by the client
|
7
|
+
# to support multiple notification callbacks.
|
8
|
+
attribute? :id, Types::String.optional
|
8
9
|
|
9
|
-
# @return [
|
10
|
+
# @return [URI] The callback URL where the agent should send push notifications.
|
11
|
+
attribute :url, Types::URI
|
12
|
+
|
13
|
+
# @return [String, nil] A unique token for this task or session to validate incoming push notifications.
|
10
14
|
attribute? :token, Types::String.optional
|
11
15
|
|
12
|
-
# @return [
|
13
|
-
|
16
|
+
# @return [PushNotificationAuthenticationInfo, nil] Optional authentication details for the agent to use when
|
17
|
+
# calling the notification URL.
|
18
|
+
attribute? :authentication, Types::Constructor(PushNotificationAuthenticationInfo).optional
|
14
19
|
end
|
15
20
|
end
|
@@ -1,15 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Error for push
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
# Error for unsupported push notifications (-32003)
|
5
|
+
#
|
6
|
+
# Raised when client attempts to use push notification features but the server agent
|
7
|
+
# does not support them (i.e., AgentCard.capabilities.pushNotifications is false).
|
8
|
+
#
|
9
|
+
# @api public
|
10
|
+
#
|
11
|
+
# @example Create a push notification not supported error
|
12
|
+
# error = JSONRPC::PushNotificationNotSupportedError.new
|
13
|
+
#
|
14
|
+
class PushNotificationNotSupportedError < JSONRPC::Error
|
15
|
+
# Creates a new Push Notification Not Supported Error with code -32003
|
16
|
+
#
|
17
|
+
# @api public
|
18
|
+
#
|
19
|
+
# @example Create a push notification not supported error with default message
|
20
|
+
# error = JSONRPC::PushNotificationNotSupportedError.new
|
21
|
+
#
|
22
|
+
# @example Create a push notification not supported error with exception details
|
23
|
+
# error = JSONRPC::PushNotificationNotSupportedError.new(data: { capability: false }, 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 = 'Push Notification is not supported.',
|
31
|
+
data: nil,
|
32
|
+
request_id: nil
|
33
|
+
)
|
34
|
+
super(
|
35
|
+
message,
|
36
|
+
code: ErrorCodes::PUSH_NOTIFICATION_NOT_SUPPORTED,
|
37
|
+
data:,
|
38
|
+
request_id:
|
39
|
+
)
|
40
|
+
end
|
14
41
|
end
|
15
42
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# A discriminated union representing all possible JSON-RPC 2.0 requests supported by the A2A specification.
|
5
|
+
Request = SendMessageRequest |
|
6
|
+
SendStreamingMessageRequest |
|
7
|
+
GetTaskRequest |
|
8
|
+
CancelTaskRequest |
|
9
|
+
SetTaskPushNotificationConfigRequest |
|
10
|
+
GetTaskPushNotificationConfigRequest |
|
11
|
+
TaskResubscriptionRequest |
|
12
|
+
ListTaskPushNotificationConfigRequest |
|
13
|
+
DeleteTaskPushNotificationConfigRequest |
|
14
|
+
GetAuthenticatedExtendedCardRequest
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# A discriminated union representing a security scheme that can be used to secure an agent's endpoints.
|
5
|
+
# This is a discriminated union type based on the OpenAPI 3.0 Security Scheme Object.
|
6
|
+
SecurityScheme = APIKeySecurityScheme |
|
7
|
+
HTTPAuthSecurityScheme |
|
8
|
+
OAuth2SecurityScheme |
|
9
|
+
OpenIdConnectSecurityScheme |
|
10
|
+
MutualTLSSecurityScheme
|
11
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Defines base properties shared by all security scheme objects.
|
5
|
+
class SecuritySchemeBase < ProtocolStruct
|
6
|
+
# @return [String, nil] An optional description for the security scheme.
|
7
|
+
attribute? :description, Types::String.optional
|
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 `message/send` method.
|
5
|
+
class SendMessageRequest < JSONRPC::Request
|
6
|
+
# @return [String] Method name for sending a message.
|
7
|
+
METHOD = 'message/send'
|
8
|
+
|
9
|
+
# @return [String] Method name for sending a message.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
11
|
+
|
12
|
+
# @return [MessageSendParams] Parameters for sending a message.
|
13
|
+
attribute :params, Types::Constructor(MessageSendParams)
|
14
|
+
|
15
|
+
# @return [String] Method name for sending a message.
|
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 `message/send` request.
|
5
|
+
# Returns either a direct Message reply or the initial Task object.
|
6
|
+
class SendMessageResponse < JSONRPC::Response
|
7
|
+
# @return [Message, Task, nil] The result, which can be a direct reply Message or the initial Task object.
|
8
|
+
attribute? :result, Types::Any.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,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Represents a JSON-RPC request for the `message/stream` method.
|
5
|
+
class SendStreamingMessageRequest < JSONRPC::Request
|
6
|
+
# @return [String] Method name for streaming a message.
|
7
|
+
METHOD = 'message/stream'
|
8
|
+
|
9
|
+
# @return [String] Method name for streaming a message.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
11
|
+
|
12
|
+
# @return [MessageSendParams] Parameters for streaming a message.
|
13
|
+
attribute :params, Types::Constructor(MessageSendParams)
|
14
|
+
|
15
|
+
# @return [String] Method name for streaming a message.
|
16
|
+
def method = attributes[:method]
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Response to a `message/stream` request.
|
5
|
+
# The server may send multiple response objects for a single request.
|
6
|
+
# Returns a Message, Task, or streaming update events.
|
7
|
+
class SendStreamingMessageResponse < JSONRPC::Response
|
8
|
+
# @return [Message, Task, TaskStatusUpdateEvent, TaskArtifactUpdateEvent, nil]
|
9
|
+
# The result, which can be a Message, Task, or streaming update event.
|
10
|
+
attribute? :result, Types::Any.optional
|
11
|
+
|
12
|
+
# @return [JSONRPC::Error, nil] Error information if the request failed.
|
13
|
+
attribute? :error, Types::Constructor(JSONRPC::Error).optional
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Represents a JSON-RPC request for the `tasks/pushNotificationConfig/set` method.
|
5
|
+
class SetTaskPushNotificationConfigRequest < JSONRPC::Request
|
6
|
+
# @return [String] Method name for setting task push notification configuration.
|
7
|
+
METHOD = 'tasks/pushNotificationConfig/set'
|
8
|
+
|
9
|
+
# @return [String] Method name for setting task push notification configuration.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
11
|
+
|
12
|
+
# @return [TaskPushNotificationConfig] Parameters for setting the push notification configuration.
|
13
|
+
attribute :params, Types::Constructor(TaskPushNotificationConfig)
|
14
|
+
|
15
|
+
# @return [String] Method name for setting task push notification configuration.
|
16
|
+
def method = attributes[:method]
|
17
|
+
end
|
18
|
+
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Request to set or update the push notification config for a task.
|
5
|
-
class SetTaskPushNotificationRequest <
|
5
|
+
class SetTaskPushNotificationRequest < JSONRPC::Request
|
6
6
|
# @return [String] Method name for setting a task notifications.
|
7
|
-
|
7
|
+
METHOD = 'tasks/pushNotificationConfig/set'
|
8
|
+
|
9
|
+
# @return [String] Method name for setting a task notifications.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
8
11
|
|
9
12
|
# @return [TaskPushNotificationConfig] Parameters for the set task push notification method.
|
10
13
|
attribute :params, Types::Constructor(TaskPushNotificationConfig)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Response to a `tasks/
|
5
|
-
class SetTaskPushNotificationResponse <
|
4
|
+
# Response to a `tasks/pushNotificationConfig/set` request. Contains the TaskPushNotificationConfig or an error.
|
5
|
+
class SetTaskPushNotificationResponse < JSONRPC::Response
|
6
6
|
# @return [TaskPushNotificationConfig, nil] The push notification config if successful.
|
7
7
|
attribute? :result, Types::Constructor(TaskPushNotificationConfig).optional
|
8
8
|
|
9
|
-
# @return [
|
10
|
-
attribute? :error, Types::Constructor(
|
9
|
+
# @return [JSONRPC::Error, nil] Error information if the request failed.
|
10
|
+
attribute? :error, Types::Constructor(JSONRPC::Error).optional
|
11
11
|
end
|
12
12
|
end
|