a2a 0.1.0.pre → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.agent-docs/ROADMAP.md +423 -0
  3. data/.agent-docs/index.md +124 -0
  4. data/.agent-docs/llms.txt +318 -0
  5. data/.agent-docs/specification/json.json +2575 -0
  6. data/.agent-docs/specification.md +1924 -0
  7. data/.agent-docs/topics/a2a-and-mcp.md +132 -0
  8. data/.agent-docs/topics/agent-discovery.md +96 -0
  9. data/.agent-docs/topics/enterprise-ready.md +139 -0
  10. data/.agent-docs/topics/extensions.md +260 -0
  11. data/.agent-docs/topics/key-concepts.md +99 -0
  12. data/.agent-docs/topics/life-of-a-task.md +255 -0
  13. data/.agent-docs/topics/streaming-and-async.md +111 -0
  14. data/.agent-docs/topics/what-is-a2a.md +218 -0
  15. data/.agent-docs/tutorials/index.md +31 -0
  16. data/.agent-docs/tutorials/python/1-introduction.md +32 -0
  17. data/.agent-docs/tutorials/python/2-setup.md +55 -0
  18. data/.agent-docs/tutorials/python/3-agent-skills-and-card.md +48 -0
  19. data/.agent-docs/tutorials/python/4-agent-executor.md +57 -0
  20. data/.agent-docs/tutorials/python/5-start-server.md +55 -0
  21. data/.agent-docs/tutorials/python/6-interact-with-server.md +95 -0
  22. data/.agent-docs/tutorials/python/7-streaming-and-multiturn.md +97 -0
  23. data/.agent-docs/tutorials/python/8-next-steps.md +40 -0
  24. data/.agent-docs/types.ts +1544 -0
  25. data/.agent-docs/types_mapping.md +196 -0
  26. data/.claude/commands/gemfile/update.md +52 -0
  27. data/.claude/settings.local.json +23 -0
  28. data/.rubocop.yml +25 -4
  29. data/.tool-versions +1 -1
  30. data/CHANGELOG.md +86 -2
  31. data/CLAUDE.md +98 -0
  32. data/Guardfile +1 -1
  33. data/README.md +55 -4
  34. data/Rakefile +1 -3
  35. data/WARP.md +115 -0
  36. data/lib/a2a/extensions/additional_properties.rb +121 -0
  37. data/lib/a2a/extensions/case_transformation.rb +46 -0
  38. data/lib/a2a/extensions/json_deserialization.rb +51 -0
  39. data/lib/a2a/types/agent_capabilities.rb +18 -0
  40. data/lib/a2a/types/agent_card.rb +71 -0
  41. data/lib/a2a/types/agent_card_signature.rb +17 -0
  42. data/lib/a2a/types/agent_extension.rb +19 -0
  43. data/lib/a2a/types/agent_interface.rb +13 -0
  44. data/lib/a2a/types/agent_provider.rb +12 -0
  45. data/lib/a2a/types/agent_skill.rb +34 -0
  46. data/lib/a2a/types/api_key_security_scheme.rb +15 -0
  47. data/lib/a2a/types/artifact.rb +24 -0
  48. data/lib/a2a/types/authenticated_extended_card_not_configured_error.rb +43 -0
  49. data/lib/a2a/types/authorization_code_oauth_flow.rb +22 -0
  50. data/lib/a2a/types/cancel_task_request.rb +18 -0
  51. data/lib/a2a/types/cancel_task_response.rb +12 -0
  52. data/lib/a2a/types/client_credentials_oauth_flow.rb +16 -0
  53. data/lib/a2a/types/content_type_not_supported_error.rb +42 -0
  54. data/lib/a2a/types/data_part.rb +12 -0
  55. data/lib/a2a/types/delete_task_push_notification_config_params.rb +9 -0
  56. data/lib/a2a/types/delete_task_push_notification_config_request.rb +18 -0
  57. data/lib/a2a/types/delete_task_push_notification_config_response.rb +13 -0
  58. data/lib/a2a/types/error.rb +19 -0
  59. data/lib/a2a/types/error_codes.rb +32 -0
  60. data/lib/a2a/types/file_base.rb +12 -0
  61. data/lib/a2a/types/file_part.rb +13 -0
  62. data/lib/a2a/types/file_with_bytes.rb +9 -0
  63. data/lib/a2a/types/file_with_uri.rb +9 -0
  64. data/lib/a2a/types/get_authenticated_extended_card_request.rb +15 -0
  65. data/lib/a2a/types/get_authenticated_extended_card_response.rb +13 -0
  66. data/lib/a2a/types/get_task_push_notification_config_params.rb +9 -0
  67. data/lib/a2a/types/get_task_push_notification_config_request.rb +21 -0
  68. data/lib/a2a/types/get_task_push_notification_request.rb +18 -0
  69. data/lib/a2a/types/get_task_push_notification_response.rb +12 -0
  70. data/lib/a2a/types/get_task_request.rb +18 -0
  71. data/lib/a2a/types/get_task_response.rb +12 -0
  72. data/lib/a2a/types/http_auth_security_scheme.rb +18 -0
  73. data/lib/a2a/types/implicit_oauth_flow.rb +16 -0
  74. data/lib/a2a/types/invalid_agent_response_error.rb +41 -0
  75. data/lib/a2a/types/list_task_push_notification_config_params.rb +8 -0
  76. data/lib/a2a/types/list_task_push_notification_config_request.rb +18 -0
  77. data/lib/a2a/types/list_task_push_notification_config_response.rb +13 -0
  78. data/lib/a2a/types/message.rb +35 -0
  79. data/lib/a2a/types/message_send_configuration.rb +20 -0
  80. data/lib/a2a/types/message_send_params.rb +16 -0
  81. data/lib/a2a/types/mutual_tls_security_scheme.rb +9 -0
  82. data/lib/a2a/types/oauth2_security_scheme.rb +16 -0
  83. data/lib/a2a/types/oauth_flows.rb +20 -0
  84. data/lib/a2a/types/openid_connect_security_scheme.rb +12 -0
  85. data/lib/a2a/types/part.rb +7 -0
  86. data/lib/a2a/types/part_base.rb +9 -0
  87. data/lib/a2a/types/password_oauth_flow.rb +16 -0
  88. data/lib/a2a/types/protocol_struct.rb +12 -0
  89. data/lib/a2a/types/push_notification_authentication_info.rb +12 -0
  90. data/lib/a2a/types/push_notification_config.rb +20 -0
  91. data/lib/a2a/types/push_notification_not_supported_error.rb +42 -0
  92. data/lib/a2a/types/request.rb +15 -0
  93. data/lib/a2a/types/security_scheme.rb +11 -0
  94. data/lib/a2a/types/security_scheme_base.rb +9 -0
  95. data/lib/a2a/types/send_message_request.rb +18 -0
  96. data/lib/a2a/types/send_message_response.rb +13 -0
  97. data/lib/a2a/types/send_streaming_message_request.rb +18 -0
  98. data/lib/a2a/types/send_streaming_message_response.rb +15 -0
  99. data/lib/a2a/types/set_task_push_notification_config_request.rb +18 -0
  100. data/lib/a2a/types/set_task_push_notification_request.rb +18 -0
  101. data/lib/a2a/types/set_task_push_notification_response.rb +12 -0
  102. data/lib/a2a/types/task.rb +29 -0
  103. data/lib/a2a/types/task_artifact_update_event.rb +29 -0
  104. data/lib/a2a/types/task_id_params.rb +12 -0
  105. data/lib/a2a/types/task_not_cancelable_error.rb +42 -0
  106. data/lib/a2a/types/task_not_found_error.rb +42 -0
  107. data/lib/a2a/types/task_push_notification_config.rb +12 -0
  108. data/lib/a2a/types/task_query_params.rb +9 -0
  109. data/lib/a2a/types/task_resubscription_request.rb +18 -0
  110. data/lib/a2a/types/task_state.rb +7 -0
  111. data/lib/a2a/types/task_status.rb +15 -0
  112. data/lib/a2a/types/task_status_update_event.rb +25 -0
  113. data/lib/a2a/types/text_part.rb +12 -0
  114. data/lib/a2a/types/transport_protocol.rb +6 -0
  115. data/lib/a2a/types/unsupported_operation_error.rb +42 -0
  116. data/lib/a2a/types.rb +25 -0
  117. data/lib/a2a/version.rb +1 -1
  118. data/lib/a2a.rb +30 -1
  119. metadata +128 -299
@@ -0,0 +1,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/.rubocop.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  plugins:
2
+ - rubocop-factory_bot
2
3
  - rubocop-performance
3
4
  - rubocop-rake
4
5
  - rubocop-rspec
@@ -15,6 +16,10 @@ Gemspec/DevelopmentDependencies:
15
16
 
16
17
  # ----------------------- Style -----------------------
17
18
 
19
+ Style/MixinUsage:
20
+ Exclude:
21
+ - bin/console
22
+
18
23
  Style/StringLiterals:
19
24
  Enabled: true
20
25
  EnforcedStyle: single_quotes
@@ -28,23 +33,39 @@ Style/StringLiteralsInInterpolation:
28
33
  Layout/LineLength:
29
34
  Max: 120
30
35
  Exclude:
31
- - hsr.gemspec
36
+ - a2a.gemspec
32
37
 
33
38
  # ---------------------- Metrics ----------------------
34
39
 
40
+ Metrics/AbcSize:
41
+ Enabled: false
42
+
35
43
  Metrics/BlockLength:
36
- Exclude:
37
- - '**/*_spec.rb'
38
- - hsr.gemspec
44
+ Enabled: false
45
+
46
+ Metrics/CyclomaticComplexity:
47
+ Enabled: false
48
+
49
+ Metrics/ClassLength:
50
+ Enabled: false
51
+
52
+ Metrics/MethodLength:
53
+ Enabled: false
39
54
 
40
55
  Metrics/ParameterLists:
41
56
  CountKeywordArgs: false
42
57
 
58
+ Metrics/PerceivedComplexity:
59
+ Enabled: false
60
+
43
61
  # ----------------------- RSpec -----------------------
44
62
 
45
63
  RSpec/ExampleLength:
46
64
  Enabled: false
47
65
 
66
+ RSpec/MultipleExpectations:
67
+ Enabled: false
68
+
48
69
  # RuboCop does not like the gem's name.
49
70
  RSpec/SpecFilePathFormat:
50
71
  Enabled: false
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.2
1
+ ruby 3.4.5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,89 @@
1
- ## [Unreleased]
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
2
3
 
3
- ## [0.1.0.pre] - 2025-03-08
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.1/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
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
+
73
+ ## [0.1.0] - 2025-05-03
74
+
75
+ ### Added
76
+
77
+ - Protocol data structures defined according to the Agent2Agent specification
78
+ - Serialization and deserialization of protocol messages
79
+ - Typed data structures with validation
80
+ - Case transformation support (snake_case ↔ camelCase) during instantiation and serialization
81
+ - Flexible schema with support for additional properties beyond defined attributes
82
+
83
+ ## [0.1.0.pre] - 2025-04-08
4
84
 
5
85
  - Pre-release
86
+
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
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/Guardfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  guard 'bundler' do
4
- watch('hsr.gemspec')
4
+ watch('a2a.gemspec')
5
5
  end
6
6
 
7
7
  guard 'bundler_audit', run_on_start: true do
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/a2a.svg)](https://badge.fury.io/rb/a2a)
4
4
  ![Build](https://github.com/wilsonsilva/a2a/actions/workflows/main.yml/badge.svg)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/c7633eb2c89eb95ee7f2/maintainability)](https://codeclimate.com/github/wilsonsilva/a2a/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/c7633eb2c89eb95ee7f2/test_coverage)](https://codeclimate.com/github/wilsonsilva/a2a/test_coverage)
5
+ [![Maintainability](https://qlty.sh/badges/73ebc4bb-d1db-4b5b-9a7c-a4acd59dfe69/maintainability.svg)](https://qlty.sh/gh/wilsonsilva/projects/a2a)
6
+ [![Code Coverage](https://qlty.sh/badges/73ebc4bb-d1db-4b5b-9a7c-a4acd59dfe69/test_coverage.svg)](https://qlty.sh/gh/wilsonsilva/projects/a2a)
7
7
 
8
8
  An open protocol enabling communication and interoperability between opaque agentic applications.
9
9
 
@@ -21,7 +21,11 @@ An open protocol enabling communication and interoperability between opaque agen
21
21
 
22
22
  ## 🔑 Key features
23
23
 
24
- TODO
24
+ - Protocol data structures defined according to the Agent2Agent specification
25
+ - Serialization and deserialization of protocol messages
26
+ - Typed data structures with validation
27
+ - Case transformation support (snake_case ↔ camelCase) during instantiation and serialization
28
+ - Flexible schema with support for additional properties beyond defined attributes
25
29
 
26
30
  ## 📦 Installation
27
31
 
@@ -31,7 +35,54 @@ Install the gem by executing:
31
35
 
32
36
  ## ⚡️ Quickstart
33
37
 
34
- TODO
38
+ ```ruby
39
+ require 'a2a'
40
+
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
55
+ )
56
+
57
+ # Build a JSON-RPC request object (no actual network request is made)
58
+ request = A2A::SendMessageRequest.new(
59
+ id: 1,
60
+ params: message_params
61
+ )
62
+
63
+ # Convert to JSON with camelCase formatting (as per protocol spec)
64
+ json_request = request.to_json
65
+ puts json_request
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"}}}
67
+
68
+ # Parse a JSON response string
69
+ agent_response = '{"jsonrpc":"2.0","id":1,"result":{"id":"task-123","contextId":"ctx-456","status":{"state":"completed"},"kind":"task"}}'
70
+
71
+ # Method 1: Parse the JSON first, then create the object
72
+ response_data = JSON.parse(agent_response)
73
+ response = A2A::SendMessageResponse.new(response_data)
74
+
75
+ # Method 2: Directly create the object from JSON (using the new from_json method)
76
+ response = A2A::SendMessageResponse.from_json(agent_response)
77
+
78
+ # Access the task information
79
+ if response.result
80
+ puts "Task status: #{response.result.status}"
81
+ puts "Messages: #{response.result.history&.length || 0}"
82
+ else
83
+ puts "Error: #{response.error&.message}"
84
+ end
85
+ ```
35
86
 
36
87
  ## 📚 Documentation
37
88
 
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)