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.
Files changed (127) 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/.tool-versions +1 -1
  29. data/CHANGELOG.md +68 -1
  30. data/CLAUDE.md +98 -0
  31. data/README.md +20 -14
  32. data/Rakefile +1 -3
  33. data/WARP.md +115 -0
  34. data/lib/a2a/extensions/json_deserialization.rb +1 -3
  35. data/lib/a2a/types/agent_capabilities.rb +3 -0
  36. data/lib/a2a/types/agent_card.rb +49 -17
  37. data/lib/a2a/types/agent_card_signature.rb +17 -0
  38. data/lib/a2a/types/agent_extension.rb +19 -0
  39. data/lib/a2a/types/agent_interface.rb +13 -0
  40. data/lib/a2a/types/agent_provider.rb +2 -2
  41. data/lib/a2a/types/agent_skill.rb +11 -4
  42. data/lib/a2a/types/api_key_security_scheme.rb +15 -0
  43. data/lib/a2a/types/artifact.rb +10 -15
  44. data/lib/a2a/types/authenticated_extended_card_not_configured_error.rb +43 -0
  45. data/lib/a2a/types/authorization_code_oauth_flow.rb +22 -0
  46. data/lib/a2a/types/cancel_task_request.rb +5 -2
  47. data/lib/a2a/types/cancel_task_response.rb +3 -3
  48. data/lib/a2a/types/client_credentials_oauth_flow.rb +16 -0
  49. data/lib/a2a/types/content_type_not_supported_error.rb +42 -0
  50. data/lib/a2a/types/data_part.rb +5 -8
  51. data/lib/a2a/types/delete_task_push_notification_config_params.rb +9 -0
  52. data/lib/a2a/types/delete_task_push_notification_config_request.rb +18 -0
  53. data/lib/a2a/types/delete_task_push_notification_config_response.rb +13 -0
  54. data/lib/a2a/types/error.rb +19 -0
  55. data/lib/a2a/types/error_codes.rb +6 -0
  56. data/lib/a2a/types/file_base.rb +12 -0
  57. data/lib/a2a/types/file_part.rb +7 -9
  58. data/lib/a2a/types/file_with_bytes.rb +9 -0
  59. data/lib/a2a/types/file_with_uri.rb +9 -0
  60. data/lib/a2a/types/get_authenticated_extended_card_request.rb +15 -0
  61. data/lib/a2a/types/get_authenticated_extended_card_response.rb +13 -0
  62. data/lib/a2a/types/get_task_push_notification_config_params.rb +9 -0
  63. data/lib/a2a/types/get_task_push_notification_config_request.rb +21 -0
  64. data/lib/a2a/types/get_task_push_notification_request.rb +5 -2
  65. data/lib/a2a/types/get_task_push_notification_response.rb +4 -4
  66. data/lib/a2a/types/get_task_request.rb +5 -2
  67. data/lib/a2a/types/get_task_response.rb +3 -3
  68. data/lib/a2a/types/http_auth_security_scheme.rb +18 -0
  69. data/lib/a2a/types/implicit_oauth_flow.rb +16 -0
  70. data/lib/a2a/types/invalid_agent_response_error.rb +41 -0
  71. data/lib/a2a/types/list_task_push_notification_config_params.rb +8 -0
  72. data/lib/a2a/types/list_task_push_notification_config_request.rb +18 -0
  73. data/lib/a2a/types/list_task_push_notification_config_response.rb +13 -0
  74. data/lib/a2a/types/message.rb +24 -4
  75. data/lib/a2a/types/message_send_configuration.rb +20 -0
  76. data/lib/a2a/types/message_send_params.rb +16 -0
  77. data/lib/a2a/types/mutual_tls_security_scheme.rb +9 -0
  78. data/lib/a2a/types/oauth2_security_scheme.rb +16 -0
  79. data/lib/a2a/types/oauth_flows.rb +20 -0
  80. data/lib/a2a/types/openid_connect_security_scheme.rb +12 -0
  81. data/lib/a2a/types/part.rb +2 -1
  82. data/lib/a2a/types/part_base.rb +9 -0
  83. data/lib/a2a/types/password_oauth_flow.rb +16 -0
  84. data/lib/a2a/types/push_notification_authentication_info.rb +12 -0
  85. data/lib/a2a/types/push_notification_config.rb +11 -6
  86. data/lib/a2a/types/push_notification_not_supported_error.rb +37 -10
  87. data/lib/a2a/types/request.rb +15 -0
  88. data/lib/a2a/types/security_scheme.rb +11 -0
  89. data/lib/a2a/types/security_scheme_base.rb +9 -0
  90. data/lib/a2a/types/send_message_request.rb +18 -0
  91. data/lib/a2a/types/send_message_response.rb +13 -0
  92. data/lib/a2a/types/send_streaming_message_request.rb +18 -0
  93. data/lib/a2a/types/send_streaming_message_response.rb +15 -0
  94. data/lib/a2a/types/set_task_push_notification_config_request.rb +18 -0
  95. data/lib/a2a/types/set_task_push_notification_request.rb +5 -2
  96. data/lib/a2a/types/set_task_push_notification_response.rb +4 -4
  97. data/lib/a2a/types/task.rb +15 -11
  98. data/lib/a2a/types/task_artifact_update_event.rb +18 -7
  99. data/lib/a2a/types/task_not_cancelable_error.rb +37 -10
  100. data/lib/a2a/types/task_not_found_error.rb +37 -10
  101. data/lib/a2a/types/task_resubscription_request.rb +5 -2
  102. data/lib/a2a/types/task_state.rb +2 -1
  103. data/lib/a2a/types/task_status_update_event.rb +13 -6
  104. data/lib/a2a/types/text_part.rb +5 -8
  105. data/lib/a2a/types/transport_protocol.rb +6 -0
  106. data/lib/a2a/types/unsupported_operation_error.rb +37 -10
  107. data/lib/a2a/types.rb +13 -0
  108. data/lib/a2a/version.rb +1 -1
  109. data/lib/a2a.rb +15 -5
  110. metadata +101 -19
  111. data/lib/a2a/types/agent_authentication.rb +0 -13
  112. data/lib/a2a/types/authentication_info.rb +0 -9
  113. data/lib/a2a/types/file_content.rb +0 -18
  114. data/lib/a2a/types/internal_error.rb +0 -15
  115. data/lib/a2a/types/invalid_params_error.rb +0 -15
  116. data/lib/a2a/types/invalid_request_error.rb +0 -15
  117. data/lib/a2a/types/json_parse_error.rb +0 -15
  118. data/lib/a2a/types/jsonrpc_error.rb +0 -15
  119. data/lib/a2a/types/jsonrpc_message.rb +0 -12
  120. data/lib/a2a/types/jsonrpc_request.rb +0 -15
  121. data/lib/a2a/types/jsonrpc_response.rb +0 -12
  122. data/lib/a2a/types/method_not_found_error.rb +0 -15
  123. data/lib/a2a/types/send_task_request.rb +0 -15
  124. data/lib/a2a/types/send_task_response.rb +0 -13
  125. data/lib/a2a/types/send_task_streaming_request.rb +0 -15
  126. data/lib/a2a/types/send_task_streaming_response.rb +0 -15
  127. data/lib/a2a/types/task_send_params.rb +0 -26
@@ -0,0 +1,196 @@
1
+ # TypeScript to Ruby A2A Type Mapping
2
+
3
+ ## Design Philosophy
4
+
5
+ The Ruby implementation follows a **consolidated approach** rather than direct TypeScript translation, favoring:
6
+ - **Inheritance and polymorphism** over separate interfaces for success/error cases
7
+ - **Fewer, more flexible classes** over granular type separation
8
+ - **Ruby idioms** like `success?`/`error?` methods over type-based discrimination
9
+
10
+ ## Legend
11
+ - ✅ **Direct mapping** - 1:1 TypeScript interface to Ruby class
12
+ - 🔄 **Consolidated mapping** - Multiple TypeScript types handled by one Ruby class
13
+ - 📝 **Design choice** - Intentional architectural difference
14
+
15
+ ## Core JSON-RPC Types
16
+
17
+ | TypeScript Type | Ruby Equivalent | Status | Notes |
18
+ |-----------------|-----------------|--------|-------|
19
+ | `JSONRPCError` | `JSONRPC::Error` | ✅ Direct mapping | |
20
+ | `JSONRPCMessage` | `JSONRPC::Request` + `JSONRPC::Response` | 🔄 **Consolidated** | Ruby uses separate Request/Response base classes |
21
+ | `JSONRPCRequest` | `JSONRPC::Request` | ✅ Direct mapping | |
22
+ | `JSONRPCSuccessResponse` | `JSONRPC::Response` (when `result` present) | 🔄 **Polymorphic** | Use `response.success?` method |
23
+ | `JSONRPCErrorResponse` | `JSONRPC::Response` (when `error` present) | 🔄 **Polymorphic** | Use `response.error?` method |
24
+
25
+ ## Standard JSON-RPC Errors
26
+
27
+ | TypeScript Type | Ruby Equivalent | Status |
28
+ |-----------------|-----------------|--------|
29
+ | `JSONParseError` | `JSONRPC::ParseError` | ✅ Direct mapping |
30
+ | `InvalidRequestError` | `JSONRPC::InvalidRequestError` | ✅ Direct mapping |
31
+ | `MethodNotFoundError` | `JSONRPC::MethodNotFoundError` | ✅ Direct mapping |
32
+ | `InvalidParamsError` | `JSONRPC::InvalidParamsError` | ✅ Direct mapping |
33
+ | `InternalError` | `JSONRPC::InternalError` | ✅ Direct mapping |
34
+
35
+ ## A2A-Specific Errors
36
+
37
+ | TypeScript Type | Ruby Equivalent | Status |
38
+ |-----------------|-----------------|--------|
39
+ | `TaskNotFoundError` | `A2A::TaskNotFoundError` | ✅ Direct mapping |
40
+ | `TaskNotCancelableError` | `A2A::TaskNotCancelableError` | ✅ Direct mapping |
41
+ | `PushNotificationNotSupportedError` | `A2A::PushNotificationNotSupportedError` | ✅ Direct mapping |
42
+ | `UnsupportedOperationError` | `A2A::UnsupportedOperationError` | ✅ Direct mapping |
43
+ | `ContentTypeNotSupportedError` | `A2A::ContentTypeNotSupportedError` | ✅ Direct mapping |
44
+ | `InvalidAgentResponseError` | `A2A::InvalidAgentResponseError` | ✅ Direct mapping |
45
+ | `AuthenticatedExtendedCardNotConfiguredError` | `A2A::AuthenticatedExtendedCardNotConfiguredError` | ✅ Direct mapping |
46
+ | `A2AError` | `A2A::Error` | ✅ Direct mapping |
47
+
48
+ ## A2A Request Types
49
+
50
+ | TypeScript Type | Ruby Equivalent | Status |
51
+ |-----------------|-----------------|--------|
52
+ | `SendMessageRequest` | `A2A::SendMessageRequest` | ✅ Direct mapping |
53
+ | `SendStreamingMessageRequest` | `A2A::SendStreamingMessageRequest` | ✅ Direct mapping |
54
+ | `GetTaskRequest` | `A2A::GetTaskRequest` | ✅ Direct mapping |
55
+ | `CancelTaskRequest` | `A2A::CancelTaskRequest` | ✅ Direct mapping |
56
+ | `SetTaskPushNotificationConfigRequest` | `A2A::SetTaskPushNotificationConfigRequest` | ✅ Direct mapping |
57
+ | `GetTaskPushNotificationConfigRequest` | `A2A::GetTaskPushNotificationConfigRequest` | ✅ Direct mapping |
58
+ | `TaskResubscriptionRequest` | `A2A::TaskResubscriptionRequest` | ✅ Direct mapping |
59
+ | `ListTaskPushNotificationConfigRequest` | `A2A::ListTaskPushNotificationConfigRequest` | ✅ Direct mapping |
60
+ | `DeleteTaskPushNotificationConfigRequest` | `A2A::DeleteTaskPushNotificationConfigRequest` | ✅ Direct mapping |
61
+ | `GetAuthenticatedExtendedCardRequest` | `A2A::GetAuthenticatedExtendedCardRequest` | ✅ Direct mapping |
62
+ | `A2ARequest` | `A2A::Request` | ✅ Direct mapping |
63
+
64
+ ## A2A Response Types - Consolidated Approach
65
+
66
+ ### TypeScript Pattern: Separate Success/Error Types
67
+ ```typescript
68
+ // TypeScript defines separate interfaces
69
+ interface SendMessageSuccessResponse extends JSONRPCSuccessResponse {
70
+ result: Message | Task;
71
+ }
72
+ type SendMessageResponse = SendMessageSuccessResponse | JSONRPCErrorResponse;
73
+ ```
74
+
75
+ ### Ruby Pattern: Unified Response Classes
76
+ ```ruby
77
+ # Ruby uses single class with polymorphic behavior
78
+ class SendMessageResponse < JSONRPC::Response
79
+ # Handles both success and error cases
80
+ # Use response.success? or response.error? to discriminate
81
+ end
82
+ ```
83
+
84
+ | TypeScript Success Type | TypeScript Union Type | Ruby Equivalent | Status |
85
+ |------------------------|----------------------|-----------------|--------|
86
+ | `SendMessageSuccessResponse` | `SendMessageResponse` | `A2A::SendMessageResponse` | 🔄 **Consolidated** |
87
+ | `SendStreamingMessageSuccessResponse` | `SendStreamingMessageResponse` | `A2A::SendStreamingMessageResponse` | 🔄 **Consolidated** |
88
+ | `GetTaskSuccessResponse` | `GetTaskResponse` | `A2A::GetTaskResponse` | 🔄 **Consolidated** |
89
+ | `CancelTaskSuccessResponse` | `CancelTaskResponse` | `A2A::CancelTaskResponse` | 🔄 **Consolidated** |
90
+ | `SetTaskPushNotificationConfigSuccessResponse` | `SetTaskPushNotificationConfigResponse` | `A2A::SetTaskPushNotificationConfigResponse` | 🔄 **Consolidated** |
91
+ | `GetTaskPushNotificationConfigSuccessResponse` | `GetTaskPushNotificationConfigResponse` | `A2A::GetTaskPushNotificationConfigResponse` | 🔄 **Consolidated** |
92
+ | `ListTaskPushNotificationConfigSuccessResponse` | `ListTaskPushNotificationConfigResponse` | `A2A::ListTaskPushNotificationConfigResponse` | 🔄 **Consolidated** |
93
+ | `DeleteTaskPushNotificationConfigSuccessResponse` | `DeleteTaskPushNotificationConfigResponse` | `A2A::DeleteTaskPushNotificationConfigResponse` | 🔄 **Consolidated** |
94
+ | `GetAuthenticatedExtendedCardSuccessResponse` | `GetAuthenticatedExtendedCardResponse` | `A2A::GetAuthenticatedExtendedCardResponse` | 🔄 **Consolidated** |
95
+
96
+ ## Core Protocol Types
97
+
98
+ | TypeScript Type | Ruby Equivalent | Status |
99
+ |-----------------|-----------------|--------|
100
+ | `AgentCard` | `A2A::AgentCard` | ✅ Direct mapping |
101
+ | `AgentProvider` | `A2A::AgentProvider` | ✅ Direct mapping |
102
+ | `AgentCapabilities` | `A2A::AgentCapabilities` | ✅ Direct mapping |
103
+ | `AgentExtension` | `A2A::AgentExtension` | ✅ Direct mapping |
104
+ | `AgentSkill` | `A2A::AgentSkill` | ✅ Direct mapping |
105
+ | `AgentInterface` | `A2A::AgentInterface` | ✅ Direct mapping |
106
+ | `AgentCardSignature` | `A2A::AgentCardSignature` | ✅ Direct mapping |
107
+ | `TransportProtocol` | `A2A::TransportProtocol` | ✅ Direct mapping |
108
+ | `Task` | `A2A::Task` | ✅ Direct mapping |
109
+ | `TaskStatus` | `A2A::TaskStatus` | ✅ Direct mapping |
110
+ | `TaskState` | `A2A::TaskState` | ✅ Direct mapping |
111
+ | `TaskStatusUpdateEvent` | `A2A::TaskStatusUpdateEvent` | ✅ Direct mapping |
112
+ | `TaskArtifactUpdateEvent` | `A2A::TaskArtifactUpdateEvent` | ✅ Direct mapping |
113
+ | `Message` | `A2A::Message` | ✅ Direct mapping |
114
+ | `Artifact` | `A2A::Artifact` | ✅ Direct mapping |
115
+ | `Part` | `A2A::Part` (union type) | ✅ Direct mapping |
116
+ | `TextPart` | `A2A::TextPart` | ✅ Direct mapping |
117
+ | `FilePart` | `A2A::FilePart` | ✅ Direct mapping |
118
+ | `DataPart` | `A2A::DataPart` | ✅ Direct mapping |
119
+ | `PartBase` | `A2A::PartBase` | ✅ Direct mapping |
120
+ | `FileBase` | `A2A::FileBase` | ✅ Direct mapping |
121
+ | `FileWithBytes` | `A2A::FileWithBytes` | ✅ Direct mapping |
122
+ | `FileWithUri` | `A2A::FileWithUri` | ✅ Direct mapping |
123
+
124
+ ## Security Types
125
+
126
+ | TypeScript Type | Ruby Equivalent | Status |
127
+ |-----------------|-----------------|--------|
128
+ | `SecurityScheme` | `A2A::SecurityScheme` (union type) | ✅ Direct mapping |
129
+ | `SecuritySchemeBase` | `A2A::SecuritySchemeBase` | ✅ Direct mapping |
130
+ | `APIKeySecurityScheme` | `A2A::APIKeySecurityScheme` | ✅ Direct mapping |
131
+ | `HTTPAuthSecurityScheme` | `A2A::HTTPAuthSecurityScheme` | ✅ Direct mapping |
132
+ | `MutualTLSSecurityScheme` | `A2A::MutualTLSSecurityScheme` | ✅ Direct mapping |
133
+ | `OAuth2SecurityScheme` | `A2A::OAuth2SecurityScheme` | ✅ Direct mapping |
134
+ | `OpenIdConnectSecurityScheme` | `A2A::OpenIdConnectSecurityScheme` | ✅ Direct mapping |
135
+ | `OAuthFlows` | `A2A::OAuthFlows` | ✅ Direct mapping |
136
+ | `AuthorizationCodeOAuthFlow` | `A2A::AuthorizationCodeOAuthFlow` | ✅ Direct mapping |
137
+ | `ClientCredentialsOAuthFlow` | `A2A::ClientCredentialsOAuthFlow` | ✅ Direct mapping |
138
+ | `ImplicitOAuthFlow` | `A2A::ImplicitOAuthFlow` | ✅ Direct mapping |
139
+ | `PasswordOAuthFlow` | `A2A::PasswordOAuthFlow` | ✅ Direct mapping |
140
+
141
+ ## Parameter Types
142
+
143
+ | TypeScript Type | Ruby Equivalent | Status |
144
+ |-----------------|-----------------|--------|
145
+ | `TaskIdParams` | `A2A::TaskIdParams` | ✅ Direct mapping |
146
+ | `TaskQueryParams` | `A2A::TaskQueryParams` | ✅ Direct mapping |
147
+ | `MessageSendParams` | `A2A::MessageSendParams` | ✅ Direct mapping |
148
+ | `MessageSendConfiguration` | `A2A::MessageSendConfiguration` | ✅ Direct mapping |
149
+ | `GetTaskPushNotificationConfigParams` | `A2A::GetTaskPushNotificationConfigParams` | ✅ Direct mapping |
150
+ | `ListTaskPushNotificationConfigParams` | `A2A::ListTaskPushNotificationConfigParams` | ✅ Direct mapping |
151
+ | `DeleteTaskPushNotificationConfigParams` | `A2A::DeleteTaskPushNotificationConfigParams` | ✅ Direct mapping |
152
+
153
+ ## Push Notification Types
154
+
155
+ | TypeScript Type | Ruby Equivalent | Status |
156
+ |-----------------|-----------------|--------|
157
+ | `PushNotificationConfig` | `A2A::PushNotificationConfig` | ✅ Direct mapping |
158
+ | `PushNotificationAuthenticationInfo` | `A2A::PushNotificationAuthenticationInfo` | ✅ Direct mapping |
159
+ | `TaskPushNotificationConfig` | `A2A::TaskPushNotificationConfig` | ✅ Direct mapping |
160
+
161
+ ## Usage Examples
162
+
163
+ ### TypeScript Approach
164
+ ```typescript
165
+ // Separate types for success/error
166
+ if (response instanceof SendMessageSuccessResponse) {
167
+ // Handle success
168
+ console.log(response.result);
169
+ } else if (response instanceof JSONRPCErrorResponse) {
170
+ // Handle error
171
+ console.log(response.error);
172
+ }
173
+ ```
174
+
175
+ ### Ruby Approach
176
+ ```ruby
177
+ # Polymorphic behavior with single class
178
+ response = A2A::SendMessageResponse.new(...)
179
+
180
+ if response.success?
181
+ # Handle success
182
+ puts response.result
183
+ else
184
+ # Handle error
185
+ puts response.error
186
+ end
187
+ ```
188
+
189
+ ## Benefits of Ruby Consolidated Approach
190
+
191
+ 1. **🔧 Less Code Duplication**: One response class per method vs. two in TypeScript
192
+ 2. **📦 Fewer Files**: Easier codebase navigation and maintenance
193
+ 3. **🏗️ Inheritance Benefits**: Shared functionality via `JSONRPC::Response` base class
194
+ 4. **🎯 Ruby Idioms**: `success?`/`error?` methods are more idiomatic than type checking
195
+ 5. **⚡ Same Functionality**: All TypeScript capabilities preserved
196
+ 6. **🔍 Type Safety**: Maintained via dry-types and optional RBS signatures
@@ -0,0 +1,52 @@
1
+ ---
2
+ allowed-tools: Bash(bundle :*), Bash(git :*), Read, Edit, MultiEdit, Glob
3
+ description: Update Gemfile dependencies to latest minor versions
4
+ argument-hint: [gemfile] [commit]
5
+ ---
6
+
7
+ Update the dependencies in the specified Gemfile (or ./Gemfile if no path provided) to their latest minor versions while
8
+ preserving major version constraints. Only update MAJOR.MINOR versions, never PATCH versions unless explicitly needed.
9
+
10
+ Steps:
11
+ 1. Read the Gemfile at the specified path (or ./Gemfile if $ARGUMENTS is empty)
12
+ 2. Read the corresponding Gemfile.lock to get current resolved versions
13
+ 3. Run `bundle outdated --only-explicit` to check for available minor updates of explicitly declared gems
14
+ 4. For each gem in Gemfile, check if Gemfile.lock has a newer minor version than the current Gemfile constraint allows
15
+ 5. Update gem version constraints to match the minor version from Gemfile.lock or latest available, whichever is newer (MAJOR.MINOR format)
16
+ 6. Use pessimistic version constraints (~> MAJOR.MINOR) to prevent automatic patch updates
17
+ 7. Preserve any existing version operators but ensure they follow minor-only update strategy
18
+ 8. Run `bundle update` to apply the changes
19
+ 7. Skip step 8, 9 and 10 if --commit flag is not provided
20
+ 8. Stage Gemfile (only if not gitignored)
21
+ 9. Verify if Gemfile.lock is tracked and not gitignored. If both conditions are met, stage it for commit.
22
+ 10. Create a git commit with message 'Update development dependencies' and a description listing all updated gems with their old and new versions like:
23
+
24
+ <commit-message>
25
+ Updated gems:
26
+ - rubocop: 1.75.2 → 1.78.0
27
+ - rubocop-yard: 0.10.0 → 1.0.0
28
+ </commit-message>
29
+
30
+ 11. If any dependencies were updated, respond only with the update message. And if the user has chose to commit,
31
+ include the update commit message. Otherwise, respond only with the no op message.
32
+
33
+ <update-message>
34
+ Updated gems:
35
+ - rbs: 3.8 → 3.9
36
+ - rubocop: 1.78 → 1.80
37
+ - rubocop-rspec: 3.6 → 3.7
38
+
39
+ <update-commit-message>The changes have been committed with the message "Update development dependencies".</update-commit-message>
40
+ </update-message>
41
+
42
+ <no-op-message>All dependencies are up to date.</no-op-message>
43
+
44
+ Key bundle outdated flags used:
45
+ - `--only-explicit`: Only show gems explicitly listed in Gemfile (not dependencies)
46
+ - No `--local` flag to ensure remote gem sources are checked for latest versions
47
+
48
+ Arguments:
49
+ - `gemfile`: Gemfile path (defaults to ./Gemfile if not provided)
50
+ - `--commit`: Create a git commit after updating dependencies with message 'Update development dependencies' and a description listing all updated gems with their old and new versions
51
+
52
+ Gemfile path: ${ARGUMENTS:-./Gemfile}
@@ -0,0 +1,23 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(./bin/console)",
5
+ "Bash(mkdir:*)",
6
+ "Bash(mv:*)",
7
+ "WebFetchTool(domain:raw.githubusercontent.com)",
8
+ "Bash(cat:*)",
9
+ "Bash(find:*)",
10
+ "WebFetch(domain:dry-rb.org)",
11
+ "mcp__context7__resolve-library-id",
12
+ "mcp__context7__get-library-docs",
13
+ "Bash(ruby:*)",
14
+ "Read(//Users/wilson/projects/rb/jsonrpc-middleware/lib/jsonrpc/**)",
15
+ "Read(//Users/wilson/projects/rb/jsonrpc-middleware/**)",
16
+ "Bash(xargs:*)",
17
+ "Bash(bundle exec rspec:*)",
18
+ "Bash(bundle exec:*)",
19
+ "Bash(bundle:*)"
20
+ ]
21
+ },
22
+ "enableAllProjectMcpServers": false
23
+ }
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.3
1
+ ruby 3.4.5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,72 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.1/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.2.0] - 2025-10-05
8
+
9
+ ### Added
10
+
11
+ - Type compatibility with version 0.3.0 of the Agent2Agent specification
12
+ - Security scheme types:
13
+ - `ApiKeySecurityScheme`
14
+ - `HttpAuthSecurityScheme`
15
+ - `OAuth2SecurityScheme` with OAuth flow types (authorization code, client credentials, implicit, password)
16
+ - `MutualTlsSecurityScheme`
17
+ - `OpenIdConnectSecurityScheme`
18
+ - Agent discovery types:
19
+ - `AgentCardSignature` for signed agent cards
20
+ - `AgentExtension` for protocol extensions
21
+ - `AgentInterface` for defining agent interfaces
22
+ - `TransportProtocol` enumeration
23
+ - File types:
24
+ - `FileBase` base class
25
+ - `FileWithBytes` for inline file content
26
+ - `FileWithURI` for file references
27
+ - Message and task types:
28
+ - `MessageSendConfiguration` and `MessageSendParams`
29
+ - `SendMessageRequest` and `SendMessageResponse`
30
+ - `SendStreamingMessageRequest` and `SendStreamingMessageResponse`
31
+ - Push notification configuration endpoints:
32
+ - `GetTaskPushNotificationConfigRequest` and `GetTaskPushNotificationConfigResponse`
33
+ - `SetTaskPushNotificationConfigRequest`
34
+ - `DeleteTaskPushNotificationConfigRequest` and `DeleteTaskPushNotificationConfigResponse`
35
+ - `ListTaskPushNotificationConfigRequest` and `ListTaskPushNotificationConfigResponse`
36
+ - `PushNotificationAuthenticationInfo`
37
+ - Error types:
38
+ - `ContentTypeNotSupportedError`
39
+ - `InvalidAgentResponseError`
40
+ - `AuthenticatedExtendedCardNotConfiguredError`
41
+ - Claude Code development command for Gemfile updates (`.claude/commands/gemfile/update.md`)
42
+
43
+ ### Changed
44
+
45
+ - Refactored URL attributes to use `Types::URI` for type safety
46
+ - Switched to `MultiJson` for JSON deserialization
47
+ - Migrated to `jsonrpc-middleware` gem for JSON-RPC protocol implementation
48
+ - Updated `AgentCard` structure with new authentication and extension fields
49
+ - Updated `Message` type with new structure and support for artifacts
50
+ - Updated `Task` type with new structure
51
+ - Refactored `Artifact`, `TaskArtifactUpdateEvent`, and `TaskStatusUpdateEvent` types
52
+ - Refactored agent and message types for specification compliance
53
+ - Updated error types to use structured error responses
54
+
55
+ ### Removed
56
+
57
+ - `TaskSendParams` (replaced by `MessageSendParams`)
58
+ - `SendTaskRequest` and `SendTaskResponse` (replaced by message send endpoints)
59
+ - `SendTaskStreamingRequest` and `SendTaskStreamingResponse` (replaced by streaming message endpoints)
60
+ - Legacy JSON-RPC types (now provided by `jsonrpc-middleware`):
61
+ - `JsonrpcMessage`
62
+ - `JsonrpcRequest`
63
+ - `JsonrpcResponse`
64
+ - `JsonrpcError`
65
+ - `InternalError`
66
+ - `InvalidParamsError`
67
+ - `InvalidRequestError`
68
+ - `JsonParseError`
69
+ - `MethodNotFoundError`
70
+ - `AgentAuthentication` and `AuthenticationInfo` (replaced by security schemes)
71
+ - `FileContent` (replaced by file type hierarchy)
72
+
7
73
  ## [0.1.0] - 2025-05-03
8
74
 
9
75
  ### Added
@@ -18,5 +84,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
18
84
 
19
85
  - Pre-release
20
86
 
21
- [0.1.0]: https://github.com/wilsonsilva/a2a/compare/v0.1.0.pre...0.1.0
87
+ [0.2.0]: https://github.com/wilsonsilva/a2a/compare/v0.1.0...v0.2.0
88
+ [0.1.0]: https://github.com/wilsonsilva/a2a/compare/v0.1.0.pre...v0.1.0
22
89
  [0.1.0.pre]: https://github.com/wilsonsilva/a2a/compare/a20b9b6...v0.1.0.pre
data/CLAUDE.md ADDED
@@ -0,0 +1,98 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## About This Project
6
+
7
+ This is the A2A (Agent2Agent) Ruby gem - an implementation of the Agent2Agent protocol enabling communication and
8
+ interoperability between opaque agentic applications. The gem provides typed data structures,
9
+ serialization/deserialization, and validation according to the A2A specification.
10
+
11
+ ## Development Commands
12
+
13
+ ### Testing and Quality Assurance
14
+ - `bundle exec rake spec` - Run RSpec tests
15
+ - `bundle exec rake coverage` - Run tests with coverage report (opens browser)
16
+ - `bundle exec rake qa` - Run full quality assurance suite (tests, linting, docs, security audit)
17
+ - `bundle exec rspec spec/path/to/specific_spec.rb` - Run a single test file
18
+ - `bundle exec rspec spec/path/to/specific_spec.rb:42` - Run specific test by line number
19
+
20
+ ### Code Quality
21
+ - `bundle exec rake rubocop` - Run RuboCop linting
22
+ - `bundle exec rake rubocop:autocorrect` - Auto-fix safe RuboCop offenses
23
+ - `bundle exec rake rubocop:autocorrect_all` - Auto-fix all RuboCop offenses (including unsafe)
24
+
25
+ ### Documentation
26
+ - `bundle exec rake yard` - Generate YARD documentation
27
+ - `bundle exec rake yard:junk` - Check for documentation issues
28
+ - `bundle exec rake verify_measurements` - Ensure 100% documentation coverage (yardstick)
29
+
30
+ ### Type Checking (Optional but Available)
31
+ - `bundle exec typeprof lib/a2a.rb` - Generate RBS type signatures
32
+ - `bundle exec steep check` - Run Steep type checking
33
+
34
+ ### Security
35
+ - `bundle exec rake bundle:audit:check` - Check for security vulnerabilities
36
+ - `bundle exec rake bundle:audit:update` - Update security vulnerability database
37
+
38
+ ### Build and Release
39
+ - `bundle exec rake build` - Build gem
40
+ - `bundle exec rake install` - Install gem locally
41
+ - `bin/console` - Open interactive console with gem loaded
42
+
43
+ ## Architecture Overview
44
+
45
+ ### Core Structure
46
+ The gem is organized around the A2A protocol specification with the following key components:
47
+
48
+ 1. **Type System (`lib/a2a/types/`)**: Complete typed implementation of A2A protocol data structures
49
+ - Agent discovery objects (AgentCard, AgentSkill, AgentCapabilities)
50
+ - Message and task objects (Message, Task, TaskStatus, Artifact)
51
+ - Security schemes and authentication structures
52
+ - JSON-RPC request/response objects
53
+ - Implements the type system defined in `.agent-docs/types.ts` (TypeScript reference definitions)
54
+ - Type mapping between TypeScript types/interfaces and Ruby classes documented in `.agent-docs/types_mapping.md`
55
+
56
+ 2. **Extensions System (`lib/a2a/extensions/`)**:
57
+ - `AdditionalProperties`: Allows flexible schema with additional properties beyond defined attributes
58
+ - `JSONDeserialization`: Handles case transformation (snake_case ↔ camelCase) during instantiation
59
+
60
+ ### Key Design Patterns
61
+
62
+ 1. **Case Transformation**: The gem handles automatic conversion between Ruby's snake_case conventions and the protocol's camelCase requirements during serialization/deserialization.
63
+ 2. **Typed Data Structures**: All protocol objects are implemented as Ruby classes with proper validation and type checking support via RBS signatures.
64
+ 3. **JSON-RPC Integration**: Built on the `jsonrpc-middleware` gem for proper JSON-RPC 2.0 protocol compliance.
65
+ 4. **Factory Pattern**: Test factories are provided for all major objects to support testing.
66
+
67
+ ### File Organization
68
+ - `lib/a2a.rb` - Main entry point with Zeitwerk loader configuration
69
+ - `lib/a2a/types/` - All protocol data structure implementations (collapsed namespace)
70
+ - `lib/a2a/extensions/` - Mixin modules for additional functionality
71
+ - `spec/` - RSpec test suite with comprehensive coverage
72
+ - `sig/a2a.rbs` - RBS type signatures for type checking
73
+
74
+ ## Development Guidelines
75
+
76
+ ### Code Style
77
+ - Follow RuboCop configuration in `.rubocop.yml`
78
+ - Target Ruby 3.4 compatibility
79
+ - Use single quotes for strings, double quotes in interpolation
80
+ - Max line length: 120 characters
81
+ - Frozen string literals required
82
+
83
+ ### Testing
84
+ - Use RSpec for all tests
85
+ - FactoryBot factories for test data
86
+ - Match JSON matchers for JSON comparison
87
+ - Aim for comprehensive test coverage
88
+ - Tests are organized to mirror the lib structure
89
+
90
+ ### Quality Thresholds
91
+ - 100% documentation coverage enforced by yardstick
92
+ - RuboCop compliance required
93
+ - Security audit checks via bundler-audit
94
+ - Type checking available via Steep
95
+
96
+ ### Git Workflow
97
+ - Overcommit hooks enforce RuboCop and trailing whitespace checks on pre-commit
98
+ - Follow conventional commit message format based on existing history
data/README.md CHANGED
@@ -38,36 +38,42 @@ Install the gem by executing:
38
38
  ```ruby
39
39
  require 'a2a'
40
40
 
41
- # Create a task send parameters object
42
- task_params = A2A::TaskSendParams.new(
43
- id: 'task-123',
44
- session_id: 'session-456',
45
- message: {
46
- content: 'Plan a trip to Paris',
47
- role: 'user'
48
- }
41
+ # Create message parts
42
+ text_part = A2A::TextPart.new(text: 'Plan a trip to Paris')
43
+
44
+ # Create a message
45
+ message = A2A::Message.new(
46
+ role: 'user',
47
+ parts: [text_part],
48
+ message_id: 'msg-123',
49
+ kind: 'message'
50
+ )
51
+
52
+ # Create message send parameters object
53
+ message_params = A2A::MessageSendParams.new(
54
+ message: message
49
55
  )
50
56
 
51
57
  # Build a JSON-RPC request object (no actual network request is made)
52
- request = A2A::SendTaskRequest.new(
58
+ request = A2A::SendMessageRequest.new(
53
59
  id: 1,
54
- params: task_params
60
+ params: message_params
55
61
  )
56
62
 
57
63
  # Convert to JSON with camelCase formatting (as per protocol spec)
58
64
  json_request = request.to_json
59
65
  puts json_request
60
- # => {"jsonrpc":"2.0","id":1,"method":"tasks/send","params":{"id":"task-123","sessionId":"session-456","message":{"content":"Plan a trip to Paris","role":"user"}}}
66
+ # => {"jsonrpc":"2.0","id":1,"method":"message/send","params":{"message":{"role":"user","parts":[{"kind":"text","text":"Plan a trip to Paris"}],"messageId":"msg-123","kind":"message"}}}
61
67
 
62
68
  # Parse a JSON response string
63
- agent_response = '{"jsonrpc":"2.0","id":1,"result":{"id":"task-123","status":"success","history":[{"role":"user","content":"Plan a trip to Paris"}]}}'
69
+ agent_response = '{"jsonrpc":"2.0","id":1,"result":{"id":"task-123","contextId":"ctx-456","status":{"state":"completed"},"kind":"task"}}'
64
70
 
65
71
  # Method 1: Parse the JSON first, then create the object
66
72
  response_data = JSON.parse(agent_response)
67
- response = A2A::SendTaskResponse.new(response_data)
73
+ response = A2A::SendMessageResponse.new(response_data)
68
74
 
69
75
  # Method 2: Directly create the object from JSON (using the new from_json method)
70
- response = A2A::SendTaskResponse.from_json(agent_response)
76
+ response = A2A::SendMessageResponse.from_json(agent_response)
71
77
 
72
78
  # Access the task information
73
79
  if response.result
data/Rakefile CHANGED
@@ -14,9 +14,7 @@ yardstick_options = YAML.load_file('.yardstick.yml')
14
14
 
15
15
  Bundler::Audit::Task.new
16
16
  RSpec::Core::RakeTask.new(:spec)
17
- RuboCop::RakeTask.new do |task|
18
- task.requires << 'rubocop-yard'
19
- end
17
+ RuboCop::RakeTask.new
20
18
  YARD::Rake::YardocTask.new
21
19
  YardJunk::Rake.define_task
22
20
  Yardstick::Rake::Measurement.new(:yardstick_measure, yardstick_options)
data/WARP.md ADDED
@@ -0,0 +1,115 @@
1
+ # WARP.md
2
+
3
+ This file provides guidance to WARP (warp.dev) when working with code in this repository.
4
+
5
+ ## Development Commands
6
+
7
+ ### Essential Commands
8
+ ```bash
9
+ # Setup development environment
10
+ bin/setup
11
+
12
+ # Interactive console for experimentation
13
+ bin/console
14
+
15
+ # Install gem locally for testing
16
+ bundle exec rake install
17
+
18
+ # Run all tests
19
+ bundle exec rspec
20
+
21
+ # Run tests with coverage (opens HTML report)
22
+ rake coverage
23
+
24
+ # Lint code with RuboCop
25
+ bundle exec rubocop
26
+
27
+ # Auto-fix RuboCop offenses (safe only)
28
+ bundle exec rubocop --autocorrect
29
+
30
+ # Run comprehensive quality assurance
31
+ rake qa
32
+ ```
33
+
34
+ ### Testing and Quality
35
+ ```bash
36
+ # Run specific test file
37
+ bundle exec rspec spec/a2a_spec.rb
38
+
39
+ # Run tests with focus on failed specs
40
+ bundle exec rspec --only-failures
41
+
42
+ # Generate YARD documentation
43
+ bundle exec yard
44
+
45
+ # Type checking with Steep
46
+ bundle exec steep check
47
+
48
+ # Security audit
49
+ bundle exec bundle-audit
50
+
51
+ # Documentation coverage measurement
52
+ rake yardstick_measure
53
+ rake verify_measurements
54
+ ```
55
+
56
+ ### Development Workflow
57
+ ```bash
58
+ # Watch files for changes (requires Guard)
59
+ bundle exec guard
60
+
61
+ # Build gem package
62
+ bundle exec rake build
63
+
64
+ # Release new version (updates version, creates tag, pushes to RubyGems)
65
+ bundle exec rake release
66
+ ```
67
+
68
+ ### Claude AI Commands
69
+ ```bash
70
+ # Update Gemfile dependencies with commit
71
+ claude --print --verbose "/gemfile:update --commit"
72
+ ```
73
+
74
+ ## Architecture Overview
75
+
76
+ ### Core Structure
77
+ - **A2A Protocol Implementation**: Ruby implementation of the Agent2Agent communication protocol
78
+ - **Dry-Struct Based**: Uses `dry-struct` for typed data structures with validation
79
+ - **Case Transformation**: Automatic conversion between snake_case (Ruby) and camelCase (JSON protocol)
80
+ - **JSON-RPC Messages**: Full support for JSON-RPC request/response patterns
81
+
82
+ ### Key Components
83
+
84
+ #### Extensions (`lib/a2a/extensions/`)
85
+ - **CaseTransformation**: Handles snake_case ↔ camelCase conversion during serialization
86
+ - **JSONDeserialization**: Enables creating objects directly from JSON strings
87
+ - **AdditionalProperties**: Supports flexible schema with extra properties
88
+
89
+ #### Types System (`lib/a2a/types/`)
90
+ - Protocol-compliant data structures (requests, responses, agents, tasks, etc.)
91
+ - All types inherit from `Dry::Struct` with validation
92
+ - Support for additional properties beyond defined attributes
93
+
94
+ ### Development Environment
95
+ - **Ruby Version**: 3.4+ required
96
+ - **Type System**: RBS type definitions in `sig/` directory
97
+ - **Testing**: RSpec with FactoryBot for test data
98
+ - **Code Quality**: RuboCop with multiple plugins (performance, RSpec, factory_bot)
99
+ - **Documentation**: YARD with 100% coverage requirement
100
+ - **Security**: Bundler Audit integration
101
+ - **CI/CD**: Overcommit hooks for pre-commit validation
102
+
103
+ ### Protocol Implementation Details
104
+ The gem provides Ruby objects for all A2A protocol message types:
105
+ - Task management (send, cancel, status)
106
+ - Agent capabilities and authentication
107
+ - File and artifact handling
108
+ - Push notifications
109
+ - Error handling with standardized codes
110
+
111
+ All objects support:
112
+ - Instantiation from hash data (with automatic key transformation)
113
+ - JSON serialization with protocol-compliant camelCase keys
114
+ - Type validation and additional property support
115
+ - Parsing from JSON strings via `from_json` methods
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
-
5
3
  module A2A
6
4
  module Extensions
7
5
  # Provides JSON deserialization capabilities to a class
@@ -45,7 +43,7 @@ module A2A
45
43
  # agent_card = A2A::AgentCard.from_json(json_string)
46
44
  #
47
45
  def from_json(json)
48
- new(JSON.parse(json))
46
+ new(MultiJson.load(json, symbolize_keys: true))
49
47
  end
50
48
  end
51
49
  end
@@ -11,5 +11,8 @@ module A2A
11
11
 
12
12
  # @return [Boolean] Indicates if the agent supports providing state transition history.
13
13
  attribute? :state_transition_history, Types::Bool.default(false)
14
+
15
+ # @return [Array<AgentExtension>, nil] A list of protocol extensions supported by the agent.
16
+ attribute? :extensions, Types::Array.of(Types::Constructor(AgentExtension)).optional
14
17
  end
15
18
  end