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
data/lib/a2a/types/agent_card.rb
CHANGED
@@ -1,39 +1,71 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
#
|
4
|
+
# The AgentCard is a self-describing manifest for an agent. It provides essential
|
5
|
+
# metadata including the agent's identity, capabilities, skills, supported
|
6
|
+
# communication methods, and security requirements.
|
5
7
|
class AgentCard < ProtocolStruct
|
6
|
-
# @return [String] The
|
8
|
+
# @return [String] The version of the A2A protocol this agent supports.
|
9
|
+
attribute :protocol_version, Types::String.default('0.3.0')
|
10
|
+
|
11
|
+
# @return [String] A human-readable name for the agent.
|
7
12
|
attribute :name, Types::String
|
8
13
|
|
9
|
-
# @return [String
|
10
|
-
|
14
|
+
# @return [String] A human-readable description of the agent, assisting users and other agents
|
15
|
+
# in understanding its purpose.
|
16
|
+
attribute :description, Types::String
|
17
|
+
|
18
|
+
# @return [URI] The preferred endpoint URL for interacting with the agent.
|
19
|
+
# This URL MUST support the transport specified by 'preferred_transport'.
|
20
|
+
attribute :url, Types::URI
|
21
|
+
|
22
|
+
# @return [String] The transport protocol for the preferred endpoint (the main 'url' field).
|
23
|
+
# If not specified, defaults to 'JSONRPC'.
|
24
|
+
attribute? :preferred_transport, Types::String.default('JSONRPC')
|
25
|
+
|
26
|
+
# @return [Array<AgentInterface>, nil] A list of additional supported interfaces (transport and URL combinations).
|
27
|
+
# This allows agents to expose multiple transports, potentially at different URLs.
|
28
|
+
attribute? :additional_interfaces, Types::Array.of(Types::Constructor(AgentInterface)).optional
|
11
29
|
|
12
|
-
# @return [
|
13
|
-
attribute :
|
30
|
+
# @return [URI, nil] An optional URL to an icon for the agent.
|
31
|
+
attribute? :icon_url, Types::URI.optional
|
14
32
|
|
15
33
|
# @return [AgentProvider, nil] Information about the provider of the agent.
|
16
34
|
attribute? :provider, Types::Constructor(AgentProvider).optional
|
17
35
|
|
18
|
-
# @return [String] The version
|
36
|
+
# @return [String] The agent's own version number. The format is defined by the provider.
|
19
37
|
attribute :version, Types::String
|
20
38
|
|
21
|
-
# @return [
|
22
|
-
attribute? :documentation_url, Types::
|
39
|
+
# @return [URI, nil] An optional URL to the agent's documentation.
|
40
|
+
attribute? :documentation_url, Types::URI.optional
|
23
41
|
|
24
|
-
# @return [AgentCapabilities]
|
42
|
+
# @return [AgentCapabilities] A declaration of optional capabilities supported by the agent.
|
25
43
|
attribute :capabilities, Types::Constructor(AgentCapabilities)
|
26
44
|
|
27
|
-
# @return [
|
28
|
-
|
45
|
+
# @return [Hash<String, SecurityScheme>, nil] A declaration of the security schemes available to authorize requests.
|
46
|
+
# The key is the scheme name. Follows the OpenAPI 3.0 Security Scheme Object.
|
47
|
+
attribute? :security_schemes, Types::Hash.map(Types::Symbol | Types::String, Types::Constructor(SecurityScheme)).optional
|
29
48
|
|
30
|
-
# @return [Array<
|
31
|
-
|
49
|
+
# @return [Array<Hash>, nil] A list of security requirement objects that apply to all agent interactions.
|
50
|
+
# Each object lists security schemes that can be used. Follows the OpenAPI 3.0 Security Requirement Object.
|
51
|
+
attribute? :security, Types::Array.of(Types::Hash.map(Types::String | Types::Symbol, Types::Array.of(Types::String))).optional
|
32
52
|
|
33
|
-
# @return [Array<String>] Default
|
34
|
-
|
53
|
+
# @return [Array<String>] Default set of supported input MIME types for all skills, which can be
|
54
|
+
# overridden on a per-skill basis.
|
55
|
+
attribute :default_input_modes, Types::Array.of(Types::String)
|
35
56
|
|
36
|
-
# @return [Array<
|
57
|
+
# @return [Array<String>] Default set of supported output MIME types for all skills, which can be
|
58
|
+
# overridden on a per-skill basis.
|
59
|
+
attribute :default_output_modes, Types::Array.of(Types::String)
|
60
|
+
|
61
|
+
# @return [Array<AgentSkill>] The set of skills, or distinct capabilities, that the agent can perform.
|
37
62
|
attribute :skills, Types::Array.of(Types::Constructor(AgentSkill))
|
63
|
+
|
64
|
+
# @return [Boolean] If true, the agent can provide an extended agent card with additional details
|
65
|
+
# to authenticated users. Defaults to false.
|
66
|
+
attribute? :supports_authenticated_extended_card, Types::Bool.default(false)
|
67
|
+
|
68
|
+
# @return [Array<AgentCardSignature>, nil] JSON Web Signatures computed for this AgentCard.
|
69
|
+
attribute? :signatures, Types::Array.of(Types::Constructor(AgentCardSignature)).optional
|
38
70
|
end
|
39
71
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# AgentCardSignature represents a JWS signature of an AgentCard.
|
5
|
+
# This follows the JSON format of an RFC 7515 JSON Web Signature (JWS).
|
6
|
+
class AgentCardSignature < ProtocolStruct
|
7
|
+
# @return [String] The protected JWS header for the signature. This is a Base64url-encoded
|
8
|
+
# JSON object, as per RFC 7515.
|
9
|
+
attribute :protected, Types::String
|
10
|
+
|
11
|
+
# @return [String] The computed signature, Base64url-encoded.
|
12
|
+
attribute :signature, Types::String
|
13
|
+
|
14
|
+
# @return [Hash, nil] The unprotected JWS header values.
|
15
|
+
attribute? :header, Types::Hash.optional
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# A declaration of a protocol extension supported by an Agent.
|
5
|
+
class AgentExtension < ProtocolStruct
|
6
|
+
# @return [URI] The unique URI identifying the extension.
|
7
|
+
attribute :uri, Types::URI
|
8
|
+
|
9
|
+
# @return [String, nil] A human-readable description of how this agent uses the extension.
|
10
|
+
attribute? :description, Types::String.optional
|
11
|
+
|
12
|
+
# @return [Boolean] If true, the client must understand and comply with the extension's requirements
|
13
|
+
# to interact with the agent.
|
14
|
+
attribute? :required, Types::Bool.default(false)
|
15
|
+
|
16
|
+
# @return [Hash, nil] Optional, extension-specific configuration parameters.
|
17
|
+
attribute? :params, Types::Hash.optional
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Declares a combination of a target URL and a transport protocol for interacting with the agent.
|
5
|
+
# This allows agents to expose the same functionality over multiple transport mechanisms.
|
6
|
+
class AgentInterface < ProtocolStruct
|
7
|
+
# @return [URI] The URL where this interface is available. Must be a valid absolute HTTPS URL in production.
|
8
|
+
attribute :url, Types::URI
|
9
|
+
|
10
|
+
# @return [String] The transport protocol supported at this URL.
|
11
|
+
attribute :transport, Types::String
|
12
|
+
end
|
13
|
+
end
|
@@ -6,7 +6,7 @@ module A2A
|
|
6
6
|
# @return [String] The name of the organization providing the agent.
|
7
7
|
attribute :organization, Types::String
|
8
8
|
|
9
|
-
# @return [
|
10
|
-
attribute
|
9
|
+
# @return [URI] A URL for the agent provider's website or relevant documentation.
|
10
|
+
attribute :url, Types::URI
|
11
11
|
end
|
12
12
|
end
|
@@ -9,11 +9,12 @@ module A2A
|
|
9
9
|
# @return [String] Human-readable name of the skill.
|
10
10
|
attribute :name, Types::String
|
11
11
|
|
12
|
-
# @return [String
|
13
|
-
|
12
|
+
# @return [String] A detailed description of the skill, intended to help clients or users
|
13
|
+
# understand its purpose and functionality.
|
14
|
+
attribute :description, Types::String
|
14
15
|
|
15
|
-
# @return [Array<String
|
16
|
-
attribute
|
16
|
+
# @return [Array<String>] A set of keywords describing the skill's capabilities.
|
17
|
+
attribute :tags, Types::Array.of(Types::String)
|
17
18
|
|
18
19
|
# @return [Array<String>, nil] Optional list of example inputs or use cases for the skill.
|
19
20
|
attribute? :examples, Types::Array.of(Types::String).optional
|
@@ -23,5 +24,11 @@ module A2A
|
|
23
24
|
|
24
25
|
# @return [Array<String>, nil] Optional list of output modes supported by this skill, overriding agent defaults.
|
25
26
|
attribute? :output_modes, Types::Array.of(Types::String).optional
|
27
|
+
|
28
|
+
# @return [Array<Hash>, nil] Security schemes necessary for the agent to leverage this skill.
|
29
|
+
# As in the overall AgentCard.security, this list represents a logical OR of security
|
30
|
+
# requirement objects. Each object is a set of security schemes that must be used together
|
31
|
+
# (a logical AND).
|
32
|
+
attribute? :security, Types::Array.of(Types::Hash.map(Types::String, Types::Array.of(Types::String))).optional
|
26
33
|
end
|
27
34
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Defines a security scheme using an API key.
|
5
|
+
class APIKeySecurityScheme < SecuritySchemeBase
|
6
|
+
# @return [String] The type of the security scheme. Must be 'apiKey'.
|
7
|
+
attribute :type, Types::String.constant('apiKey')
|
8
|
+
|
9
|
+
# @return [String] The location of the API key.
|
10
|
+
attribute :in, Types::String.enum('query', 'header', 'cookie')
|
11
|
+
|
12
|
+
# @return [String] The name of the header, query, or cookie parameter to be used.
|
13
|
+
attribute :name, Types::String
|
14
|
+
end
|
15
|
+
end
|
data/lib/a2a/types/artifact.rb
CHANGED
@@ -1,29 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Represents
|
4
|
+
# Represents a file, data structure, or other resource generated by an agent during a task.
|
5
5
|
class Artifact < ProtocolStruct
|
6
|
-
# @return [String
|
6
|
+
# @return [String] A unique identifier (e.g. UUID) for the artifact within the scope of the task.
|
7
|
+
attribute :artifact_id, Types::String
|
8
|
+
|
9
|
+
# @return [String, nil] An optional, human-readable name for the artifact.
|
7
10
|
attribute? :name, Types::String.optional
|
8
11
|
|
9
|
-
# @return [String, nil]
|
12
|
+
# @return [String, nil] An optional, human-readable description of the artifact.
|
10
13
|
attribute? :description, Types::String.optional
|
11
14
|
|
12
|
-
# @return [Array<Part>]
|
15
|
+
# @return [Array<Part>] An array of content parts that make up the artifact.
|
13
16
|
attribute :parts, Types::Array.of(Types::Constructor(Part))
|
14
17
|
|
15
|
-
# @return [
|
16
|
-
attribute? :index, Types::Integer.default(0)
|
17
|
-
|
18
|
-
# @return [Boolean, nil] Optional flag indicating if this artifact content should append to previous
|
19
|
-
# content (for streaming).
|
20
|
-
attribute? :append, Types::Bool.optional
|
21
|
-
|
22
|
-
# @return [Hash, nil] Optional metadata associated with the artifact.
|
18
|
+
# @return [Hash, nil] Optional metadata for extensions. The key is an extension-specific identifier.
|
23
19
|
attribute? :metadata, Types::Hash.optional
|
24
20
|
|
25
|
-
# @return [
|
26
|
-
|
27
|
-
attribute? :last_chunk, Types::Bool.optional
|
21
|
+
# @return [Array<String>, nil] The URIs of extensions that are relevant to this artifact.
|
22
|
+
attribute? :extensions, Types::Array.of(Types::String).optional
|
28
23
|
end
|
29
24
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Error for missing authenticated extended card configuration (-32007)
|
5
|
+
#
|
6
|
+
# Raised when the agent does not have an Authenticated Extended Card configured.
|
7
|
+
#
|
8
|
+
# @api public
|
9
|
+
#
|
10
|
+
# @example Create an authenticated extended card not configured error
|
11
|
+
# error = JSONRPC::AuthenticatedExtendedCardNotConfiguredError.new
|
12
|
+
#
|
13
|
+
class AuthenticatedExtendedCardNotConfiguredError < JSONRPC::Error
|
14
|
+
# Creates a new Authenticated Extended Card Not Configured Error with code -32007
|
15
|
+
#
|
16
|
+
# @api public
|
17
|
+
#
|
18
|
+
# @example Create an authenticated extended card not configured error with default message
|
19
|
+
# error = JSONRPC::AuthenticatedExtendedCardNotConfiguredError.new
|
20
|
+
#
|
21
|
+
# @example Create an authenticated extended card not configured error with exception details
|
22
|
+
# error = JSONRPC::AuthenticatedExtendedCardNotConfiguredError.new(
|
23
|
+
# data: { feature: 'extended_card' }, request_id: 1
|
24
|
+
# )
|
25
|
+
#
|
26
|
+
# @param message [String] short description of the error
|
27
|
+
# @param data [Hash, Array, String, Number, Boolean, nil] additional error information
|
28
|
+
# @param request_id [String, Integer, nil] the request identifier
|
29
|
+
#
|
30
|
+
def initialize(
|
31
|
+
message = 'Authenticated Extended Card not configured.',
|
32
|
+
data: nil,
|
33
|
+
request_id: nil
|
34
|
+
)
|
35
|
+
super(
|
36
|
+
message,
|
37
|
+
code: ErrorCodes::AUTHENTICATED_EXTENDED_CARD_NOT_CONFIGURED,
|
38
|
+
data:,
|
39
|
+
request_id:
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module A2A
|
4
|
+
# Defines configuration details for the OAuth 2.0 Authorization Code flow.
|
5
|
+
class AuthorizationCodeOAuthFlow < ProtocolStruct
|
6
|
+
# @return [URI] The authorization URL to be used for this flow.
|
7
|
+
# This MUST be a URL and use TLS.
|
8
|
+
attribute :authorization_url, Types::URI
|
9
|
+
|
10
|
+
# @return [URI] The token URL to be used for this flow.
|
11
|
+
# This MUST be a URL and use TLS.
|
12
|
+
attribute :token_url, Types::URI
|
13
|
+
|
14
|
+
# @return [URI, nil] The URL to be used for obtaining refresh tokens.
|
15
|
+
# This MUST be a URL and use TLS.
|
16
|
+
attribute? :refresh_url, Types::URI.optional
|
17
|
+
|
18
|
+
# @return [Hash] The available scopes for the OAuth2 security scheme. A map between the scope
|
19
|
+
# name and a short description for it.
|
20
|
+
attribute :scopes, Types::Hash.map(Types::String, Types::String)
|
21
|
+
end
|
22
|
+
end
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Request to cancel a currently running task.
|
5
|
-
class CancelTaskRequest <
|
5
|
+
class CancelTaskRequest < JSONRPC::Request
|
6
6
|
# @return [String] Method name for canceling a task.
|
7
|
-
|
7
|
+
METHOD = 'tasks/cancel'
|
8
|
+
|
9
|
+
# @return [String] Method name for canceling a task.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
8
11
|
|
9
12
|
# @return [TaskIdParams] Parameters for the cancel task method.
|
10
13
|
attribute :params, Types::Constructor(TaskIdParams)
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Response to a `tasks/cancel` request. Contains the updated Task object or an error.
|
5
|
-
class CancelTaskResponse <
|
5
|
+
class CancelTaskResponse < JSONRPC::Response
|
6
6
|
# @return [Task, nil] The canceled 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,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
|
data/lib/a2a/types/data_part.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Represents a
|
5
|
-
class DataPart <
|
6
|
-
# @return [String]
|
7
|
-
attribute :
|
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
8
|
|
9
|
-
# @return [Hash] The structured data content
|
9
|
+
# @return [Hash] The structured data content.
|
10
10
|
attribute :data, Types::Hash
|
11
|
-
|
12
|
-
# @return [Hash, nil] Optional metadata associated with this data part.
|
13
|
-
attribute? :metadata, Types::Hash.optional
|
14
11
|
end
|
15
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
|
@@ -22,5 +22,11 @@ module A2A
|
|
22
22
|
PUSH_NOTIFICATION_NOT_SUPPORTED = -32_003
|
23
23
|
# The requested operation is not supported by the agent
|
24
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
|
25
31
|
end
|
26
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
|
data/lib/a2a/types/file_part.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module A2A
|
4
|
-
# Represents a
|
5
|
-
|
6
|
-
|
7
|
-
|
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')
|
8
9
|
|
9
|
-
# @return [
|
10
|
-
attribute :file, Types::Constructor(
|
11
|
-
|
12
|
-
# @return [Hash, nil] Optional metadata associated with this file part.
|
13
|
-
attribute? :metadata, Types::Hash.optional
|
10
|
+
# @return [FileWithBytes | FileWithUri] The file content, represented as either a URI or as base64-encoded bytes.
|
11
|
+
attribute :file, Types::Constructor(FileWithBytes | FileWithUri)
|
14
12
|
end
|
15
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,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
|
@@ -2,9 +2,12 @@
|
|
2
2
|
|
3
3
|
module A2A
|
4
4
|
# Request to retrieve the currently configured push notification configuration for a task.
|
5
|
-
class GetTaskPushNotificationRequest <
|
5
|
+
class GetTaskPushNotificationRequest < JSONRPC::Request
|
6
6
|
# @return [String] Method name for getting task notification configuration.
|
7
|
-
|
7
|
+
METHOD = 'tasks/pushNotificationConfig/get'
|
8
|
+
|
9
|
+
# @return [String] Method name for getting task notification configuration.
|
10
|
+
attribute :method, Types::String.constant(METHOD)
|
8
11
|
|
9
12
|
# @return [TaskIdParams] Parameters for the get task push notification config method.
|
10
13
|
attribute :params, Types::Constructor(TaskIdParams)
|