a2a-rails 0.3.0.rc1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28e6e84db258492d965f909914a94906dc8de57c0e390eb36ce4749ababa4741
4
- data.tar.gz: 421a68f93bb61827857f380fe7fed8a801a97acc2fbf9569297a782d9e6bb43b
3
+ metadata.gz: 7810ba3ee58350b09b8239ff5b4ffec63ec1a21fbe6ece6b670af6678ad4ce55
4
+ data.tar.gz: 553c7f4e6290a20f0ccb0698f0568d057ff6d29a43d8706ed982de3223382bda
5
5
  SHA512:
6
- metadata.gz: 849551ca60cf796328da07761d4c8fe5f7a5ebd5860028af88a1affd97775b491c1677ef963b96fb377504e6198e05260416a458f7e5821b137aeaa8e2eb62ff
7
- data.tar.gz: 00b4174d36e073db0aa70a2bb3199c1edc59226b334197b506aaf29347f2168324e809a1290e9a5d8961e1e07e00a728e8ddc859099e4d140d364c9f17a6933e
6
+ metadata.gz: 100976286a6676996729e2834f4ee5f27cc939cb2b9c6a6d2ee3120cc0d4bfc8669cf72c24e3e131b8f034f5902c0e26892968085413117343727c507c24f595
7
+ data.tar.gz: 32199a0dc4cd86318b3c98a819876e3e74efabfa330cc2fb5184482575d80a5370eac6f8ca3dfd4403249cf186a71f5b6ba980a222fdd67420857c6debe06fd9
data/CHANGELOG.md CHANGED
@@ -4,7 +4,49 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.3.0.rc1] - 2026-10-10 (pre-release candidate)
7
+ ## [0.4.0] — release preparation (not yet published)
8
+
9
+ > Packaging and verification only. See the [0.4.0 release checklist](docs/release/v0.4.0-preparation.md).
10
+
11
+ - Add opt-in inbound JSON object Data Parts on Skills declaring
12
+ `application/json`; the input contract is enforced after Routing and before
13
+ Handler execution or Task admission.
14
+ - Preserve nested JSON nulls and exact application keys through SDK
15
+ serialization, Task history and results. No database migration or SDK
16
+ dependency change. Existing text, Task and direct Message flows remain.
17
+ - Keep Hash and Array Data output; the Rails Client now reads both. Object-only
18
+ is a Rails Server **input** restriction, not an output restriction.
19
+ - See the [structured Data guide](docs/guides/structured-data.md) for the
20
+ normalized MIME type, accepted values and rollout instructions.
21
+
22
+ ## [0.3.0] - 2026-10-10 (published stable release)
23
+
24
+ > **Published after explicit maintainer GO.** [GitHub Release v0.3.0](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0) · [RubyGems a2a-rails 0.3.0](https://rubygems.org/gems/a2a-rails/versions/0.3.0). Immutable annotated tag targets commit `772f63fc814123f39b40bafd7403f3ef9a59788e`; the Gem SHA256 is `90a7d8d32bdd19ebc97046a3307c483cc0798b06afcd79df4931cfc5a4ead40f`. Exact final-main CI **49/49 jobs passed**. Gem uploaded without rebuilding; original RubyGems package was fetched and matched. [Step 31-6 publication record](docs/release/v0.3.0-publication-record.md).
25
+
26
+ `0.3.0` advances the outbound A2A Client tested in `0.3.0.rc1` while retaining the existing Rails A2A Server default. [Release verification record](docs/release/v0.3.0-stable-candidate-record.md) and [Step 31 tracking issue](https://github.com/cuichangquan/a2a-rails/issues/120) contain the dated CI/provenance history. Consult [GitHub Releases](https://github.com/cuichangquan/a2a-rails/releases) or [RubyGems versions](https://rubygems.org/gems/a2a-rails/versions) for actual publication status; source versions and CI artifacts alone are not public releases.
27
+
28
+ ### Added and retained behavior
29
+
30
+ - Outbound `A2A::Rails::Client` for secure HTTPS Agent Card discovery and A2A v1.0 JSON-RPC `SendMessage`, `GetTask`, `ListTasks`, and `CancelTask`; immutable Ruby DTOs preserve Task, direct Message, rich Parts, cursors and protocol errors.
31
+ - Client-only Rails hosts can set `config.server_enabled = false`. Existing Server applications keep `server_enabled = true` by default and retain the authenticated Task Store, ActiveRecord and ActiveJob behavior shipped in `0.2.0`.
32
+ - Public outbound Client has exact HTTPS-origin allowlisting, DNS and pinned public-IPv4 socket checks, peer/hostname/SNI certificate verification, Card/RPC credential separation, bounded HTTP and parsing, and no automatic side-effect retries.
33
+
34
+ ### Dependency security and compatibility
35
+
36
+ - The direct `json` dependency now requires **`>= 2.19.9, < 3`** after an early `0.3.0` candidate audit caught vulnerable older resolved versions. Ruby 3.3/3.4/4.0 and Rails 8.0/8.1 host compatibility is exercised in CI.
37
+ - A full Rails host can independently resolve an affected `net-imap` release via its mail stack. The six-host candidate audit selects patched `net-imap ~> 0.5.15`; `net-imap` is **not** a direct dependency of this Gem. **Consumers must update/audit their own Gemfile.lock**.
38
+ - The final candidate's six audited host lockfiles had no matching advisories in RubySec at the time of the 2026-10-10 check; this is **not** a guarantee about future advisories, other lockfiles, host Ruby/OS or independently audited security.
39
+ - Existing local test-only TLS adapters are not supported production Client bypasses. No streaming/SSE, push, gRPC, IPv6-only outgoing hosts, generic retries/polling, OAuth issuer or universal production identity/tenant configuration is included.
40
+
41
+ ### Documentation and evidence
42
+
43
+ - [Upgrade guide from v0.2.0](docs/release/upgrading-v0.2.0-to-v0.3.md), [RC1 feedback snapshot](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md), [candidate provenance](docs/release/v0.3.0-stable-candidate-record.md) and [confidential security reporting](SECURITY.md).
44
+ - Official pinned A2A TCK baseline remains **63 passed / 1 known upstream-fixture failure / 171 skipped / 30 deselected**; green informational workflow does not establish full A2A certification.
45
+ - Gem publication and exposing a public/no-auth A2A Server are **separate decisions**. Deployment requires host IdP, business authorization, rate limits, durable workers/storage and safe logging per [Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11).
46
+
47
+ ## [0.3.0.rc1] - 2026-10-10 (published pre-release)
48
+
49
+ > **Published after explicit owner GO:** [RubyGems RC1](https://rubygems.org/gems/a2a-rails/versions/0.3.0.rc1) and [GitHub Pre-release](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0-rc1), from source `664a201e6df9173e1656bb5f25b503821c0be2b5`, using the same build-once Gem. SHA256: `e5b184e615f9f59c3db770d150b96e847fa5df83ca152e274ae55c656b68feda`. See the [publication record](docs/release/v0.3.0-rc1-publication-record.md). At the time of the `0.3.0.rc1` pre-release announcement, stable `0.3.0` was not yet released.
8
50
 
9
51
  > **Pre-release candidate, not a stable-production security certification.**
10
52
  > This candidate contains the previously unreleased outbound Client changes
@@ -37,8 +79,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
37
79
  SendMessage/CancelTask timeout and nested response validation.
38
80
  - **Go SDK follow-up:** Step 29-5q verified authenticated Go ListTasks pagination with two scoped test users and isolated Task visibility; anonymous callers still receive `-31401`.
39
81
  - **Release evidence and limitations:** Exact-version source and Gem are
40
- subject to mandatory build-once/SHA256, installed Ruby/Rails/PostgreSQL,
41
- native Python/Go interoperability and security regression checks.
82
+ verified by build-once/SHA256, installed Ruby/Rails/PostgreSQL,
83
+ native Python/Go interoperability and security regression checks; the
84
+ public RubyGems download matches the verified Gem byte-for-byte.
42
85
  [Step 29-5u risk-based release policy](docs/release/step-29-5u-risk-based-oss-release-policy.md)
43
86
  makes third-party security audit **optional** and does not assert a
44
87
  certification. No known unresolved Critical/High code defect is acceptable
data/README.md CHANGED
@@ -1,68 +1,24 @@
1
1
  # a2a-rails
2
- <img src="docs/assets/a2a-rails-infographics.png">
3
- <br/>
4
- <br/>
5
- <img src="docs/assets/a2a-rails-infographics-en.png">
6
2
 
7
- Rails-native integration for exposing Rails applications as A2A v1.0 agents.
3
+ Rails-native A2A v1.0 integration: expose Rails business logic as an Agent, call remote Agents, or do both. Application handlers use Ruby Hashes rather than SDK request objects.
8
4
 
9
- > **Release status (2026-10-08):** **`0.2.0` is published as a stable release** on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.2.0) and [GitHub](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0). It includes the Rails/Zeitwerk and migration-generator fixes after rc2. The public Gem matches the verified artifact byte-for-byte; see the [publication record](docs/release/v0.2.0-publication-record.md).
5
+ > **Latest stable release (2026-10-10): [a2a-rails v0.3.0](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0) is now published on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.3.0).** It adds the outbound Rails A2A Client and optional Client-only mode while preserving the existing Server default. [Official publication & SHA256 record](docs/release/v0.3.0-publication-record.md). **Gem publication is not approval to run an anonymous/public production Agent; deployment #11 remains separate.**
10
6
 
11
- - RubyGems: https://rubygems.org/gems/a2a-rails
12
- - Published stable release: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0
13
- - Previous stable release: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.1.0
14
- - Changelog: [CHANGELOG.md](CHANGELOG.md)
15
- - Release record: [v0.2.0 publication record](docs/release/v0.2.0-publication-record.md)
16
- - **Security policy / 脆弱性報告:** [SECURITY.md](SECURITY.md) — confidential vulnerability reporting, current assurance boundaries and production responsibilities.
17
- - **v0.3.x prerelease policy:** [Risk-based release gates](docs/release/step-29-5u-risk-based-oss-release-policy.md) — independently commissioned external audit is **recommended but optional**, not a known vulnerability or RubyGems requirement. Technical security checks, no known unresolved Critical/High findings, exact Gem provenance and explicit maintainer release approval remain mandatory; [optional community review #113](https://github.com/cuichangquan/a2a-rails/issues/113). **No v0.3.x has been published.**
18
- - **Release readiness:** [current release/deployment checklist](docs/release/security-hardening-release-checklist.md) · [v0.1.0 → v0.2.0 upgrade guide](docs/release/upgrading-v0.1.0-to-v0.2.md). The old rc1 record is historical evidence only.
19
- - **Roadmap / 次にやること:** [ROADMAP.md](ROADMAP.md) — [Step 26 / Issue #62](https://github.com/cuichangquan/a2a-rails/issues/62) records the `0.2.0` stable release gates; [production Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11) remains open. See [stable-readiness record](docs/release/v0.2.0-stable-readiness.md).
20
- - **Official A2A TCK results:** [Pinned JSON-RPC MUST report and reproduction](docs/testing/official-a2a-tck.md) — after Step 17-4: **63 passed / 1 failed / 171 skipped / 30 deselected** (pytest). The remaining `CORE-SEND-003` mismatch is tracked [upstream in #202](https://github.com/a2aproject/a2a-tck/issues/202). The TCK workflow is informational, **not** an A2A conformance certificate.
21
-
22
- - [A2Aの全体像(日本語・A4 1枚PDF)](docs/guides/a2a-protocol-overview-ja.pdf) — 登場人物・依頼の流れ・主要用語・MCPとの違いをまとめた学習資料。
23
- - [A2A at a glance (English, A4 one-page PDF)](docs/guides/a2a-protocol-overview-en.pdf) — Roles, workflow, key terms, and how MCP fits.
24
-
25
- ## Runnable Rails Demo / 実際に動くサンプル ⭐
7
+ ## Choose your starting point
26
8
 
27
- **[a2a-rails-demo — independent Rails 8 Echo Agent](https://github.com/cuichangquan/a2a-rails-demo)**
9
+ | Goal | Setup | Next step |
10
+ | --- | --- | --- |
11
+ | Expose a Rails Agent | Server enabled by default | [Server Quick Start](#server-quick-start-local-development) |
12
+ | Call an external Agent only | Set `server_enabled = false`; no Agent scaffold | [Client-only Quick Start](#client-only-quick-start) |
13
+ | Serve and call Agents | Keep Server enabled and construct a Client | Server setup plus [Client guide](docs/guides/outbound-a2a-client.md) |
28
14
 
29
- Run a complete standalone Rails Agent using the **published RubyGems `a2a-rails = 0.2.0`** (not a Git source checkout). The separate Demo covers Agent Card discovery, JSON-RPC v1.0 SendMessage **Task and direct Message**, GetTask, ListTasks and error handling.
15
+ The current stable line includes the outbound Client (0.3.0), optional ActiveRecord Task storage and ActiveJob execution (since 0.2.0). Execution is synchronous and Task storage is process-local by default. Streaming, push notifications and gRPC are unsupported.
30
16
 
31
- - [Demo Quick Start, code and example curl requests](https://github.com/cuichangquan/a2a-rails-demo#quick-start).
32
- - [Demo GitHub Actions smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/workflows/smoke.yml) — independent Rails 8.1.0 / Ruby 3.4.10 HTTP smoke **16/16 checks passed** against published Gem `0.2.0` ([Step 28 Demo PR #2, merged](https://github.com/cuichangquan/a2a-rails-demo/pull/2), [passing PR CI](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/37736426834)). The CI also confirms `A2A::Rails::VERSION == "0.2.0"`, RubyGems as the dependency source, and the demo's production-startup refusal.
33
- - **Local-only development/test** demo: no trusted verifier or durable Task store, **not** an internet-facing production template. See [production security](docs/guides/production-security.md).
17
+ ## Host and security responsibilities
34
18
 
35
- ## What is a2a-rails?
19
+ The Server Quick Start is for local development/test. Outside those environments, the Server fails closed without a host authenticator. The host must supply credential verification, business authorization, TLS/proxy restrictions, rate limits and execution budgets. Multi-worker Task access needs a shared durable Task store; async production execution also needs a durable queue. See [authentication](docs/guides/authentication.md), [production security](docs/guides/production-security.md) and [SECURITY.md](SECURITY.md).
36
20
 
37
- `a2a-rails` lets a Rails application expose an A2A-compatible Agent without making application code depend directly on SDK-specific request and response objects.
38
-
39
- ```text
40
- A2A Protocol
41
- ↓
42
- Ruby A2A SDK
43
- ↓
44
- a2a-rails
45
- ↓
46
- Rails Application
47
- ↓
48
- Business Logic
49
- ```
50
-
51
- The Gem provides:
52
-
53
- - a Rails-native Agent / Skill DSL;
54
- - A2A Agent Card generation;
55
- - automatically mounted A2A HTTP endpoints;
56
- - synchronous Task execution by default, plus opt-in ActiveJob-backed async Task execution in published `0.2.0`;
57
- - SDK-independent Handler inputs;
58
- - a process-local MemoryStore by default, plus an optional durable ActiveRecordStore in `0.2.0`;
59
- - Rails generators for initial setup;
60
- - an internal Protocol Adapter boundary around the upstream SDK.
61
-
62
- v0.1 is intentionally **server-first** and **non-streaming**.
63
-
64
- > [!WARNING]
65
- > **Security / production use:** v0.1.0 does not provide built-in authentication or per-caller Task authorization. Do not expose `POST /a2a` to untrusted clients. Before public deployment, protect the endpoint at your application's or network's security boundary. Security hardening is tracked in [Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11).
21
+ The outbound Client requires explicitly approved HTTPS origins and public IPv4 destinations. The host supplies origin-scoped credentials, safe logging and reconciliation after ambiguous timeouts. Never weaken SSRF/TLS policy to connect this Client to the localhost Server example. See [Client security and limitations](docs/guides/outbound-a2a-client.md).
66
22
 
67
23
  ## Requirements
68
24
 
@@ -78,24 +34,53 @@ The original v0.1.0 baseline was verified against:
78
34
 
79
35
  ## Installation
80
36
 
81
- Add the Gem to an existing Rails application:
37
+ In an existing Rails application, pin the published stable Gem:
82
38
 
83
39
  ```bash
84
- bundle add a2a-rails
40
+ bundle add a2a-rails --version '= 0.3.0'
85
41
  ```
86
42
 
87
- Then generate the initializer and an Agent scaffold:
43
+ If you need a fresh app first (with a supported Rails installed):
88
44
 
89
45
  ```bash
90
- bin/rails generate a2a:rails:install
91
- bin/rails generate a2a:rails:agent echo
46
+ rails new echo_app --minimal --skip-active-record
47
+ cd echo_app
48
+ bundle add a2a-rails --version '= 0.3.0'
49
+ ```
50
+
51
+ Then choose Server or Client-only setup below. No explicit Engine mount is needed.
52
+
53
+ ## Client-only Quick Start
54
+
55
+ Create `config/initializers/a2a_rails.rb` before booting Rails:
56
+
57
+ ```ruby
58
+ A2A::Rails.configure do |config|
59
+ config.server_enabled = false
60
+ end
92
61
  ```
93
62
 
94
- No explicit Engine mount or host `config/routes.rb` change is required.
63
+ No Agent or Handler is required; both inbound A2A paths remain unmounted. Restart Rails after changing this setting. In `bin/rails console`, construct a Client for an Agent you are authorized to call:
95
64
 
96
- ## Quick Start
65
+ ```ruby
66
+ client = A2A::Rails::Client.new(
67
+ agent_card_url: "https://your-agent.example/.well-known/agent-card.json",
68
+ allowed_origins: ["https://your-agent.example"]
69
+ )
70
+ card = client.agent_card
71
+ result = client.send_message(message: {
72
+ message_id: SecureRandom.uuid,
73
+ role: "ROLE_USER",
74
+ parts: [{ text: "Hello" }]
75
+ })
76
+ result.kind # => :task or :message
77
+ ```
97
78
 
98
- The following Echo flow is verified against the published `a2a-rails 0.1.0` Gem in a clean Rails 8.1 application.
79
+ Replace the placeholder with a real approved HTTPS Agent. For an authenticated Agent, configure credential callbacks bound to the exact receiving origin; see the [Client guide](docs/guides/outbound-a2a-client.md) for credentials, Task operations, errors and timeout handling. See the [existing Client demo](https://github.com/cuichangquan/a2a-rails-client-demo) for isolated TLS verification.
80
+
81
+ ## Server Quick Start (local development)
82
+
83
+ Use the published `a2a-rails 0.3.0` Gem installed above in development. The Echo flow uses synchronous execution and MemoryStore; no database or queue is required. If you previously selected Client-only mode, remove `server_enabled = false` and restart Rails.
99
84
 
100
85
  ### 1. Generate the setup
101
86
 
@@ -176,7 +161,7 @@ The Agent class name remains a String until an A2A endpoint resolves it, preserv
176
161
  Start Rails:
177
162
 
178
163
  ```bash
179
- bin/rails server
164
+ bin/rails server -b 127.0.0.1
180
165
  ```
181
166
 
182
167
  Then request the Agent Card:
@@ -220,7 +205,56 @@ result.task.status.state == TASK_STATE_COMPLETED
220
205
  Artifact Text Part == "Echo: Hello"
221
206
  ```
222
207
 
223
- See [docs/design/quick-start.md](docs/design/quick-start.md) for the design and verification notes behind this flow.
208
+ See the [historical v0.1 Quick Start design](docs/design/quick-start.md) for the original generator contract. For a complete working app, use the [existing Rails demo](https://github.com/cuichangquan/a2a-rails-demo).
209
+
210
+ ## Runnable Rails Demo / 実際に動くサンプル ⭐
211
+
212
+ **[a2a-rails-demo — independent Rails 8 Echo Agent](https://github.com/cuichangquan/a2a-rails-demo)**
213
+
214
+ Run a complete standalone Rails Agent using the **published RubyGems `a2a-rails = 0.3.0`** (not a Git source checkout). The separate Demo covers Agent Card discovery, JSON-RPC v1.0 SendMessage **Task and direct Message**, GetTask, ListTasks and error handling.
215
+
216
+ - [Demo Quick Start, code and example curl requests](https://github.com/cuichangquan/a2a-rails-demo#quick-start).
217
+ - [Demo GitHub Actions smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/workflows/smoke.yml) — independent Rails 8.1.4 / Ruby 3.4.10 HTTP smoke against published stable Gem `0.3.0` ([Step 32 Server PR #3, merged](https://github.com/cuichangquan/a2a-rails-demo/pull/3), [passing CI](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/38097407649)). Verifies the actual published Gem and dependency versions, Task/direct Message/GetTask/ListTasks/CancelTask and refusal to boot in production. The historical [Step 28 v0.2.0 smoke](https://github.com/cuichangquan/a2a-rails-demo/actions/runs/37736426834) is preserved separately.
218
+ - **Local-only development/test** demo: no trusted verifier or durable Task store, **not** an internet-facing production template. See [production security](docs/guides/production-security.md).
219
+
220
+ ### Outbound Client-only Rails Demo / 外部A2A Agentを呼び出すサンプル
221
+
222
+ **[a2a-rails-client-demo — standalone Rails 8 Client](https://github.com/cuichangquan/a2a-rails-client-demo)**
223
+
224
+ Independent Client-only Rails application **now tested against published stable RubyGems `a2a-rails = 0.3.0`** with `server_enabled = false`. It discovers Agent Cards and calls SendMessage (Task/direct Message), GetTask and ListTasks using exact HTTPS origin allowlisting. [Stable Client CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38097502077) and [independent Rails-to-Rails pinned-TLS CI PASS](https://github.com/cuichangquan/a2a-rails-client-demo/actions/runs/38097502218) use **published stable 0.3.0 on both Rails sides** and actual Server Echo business logic ([Step 32 Client PR #3](https://github.com/cuichangquan/a2a-rails-client-demo/pull/3)). The loopback-only bridge uses an ephemeral test CA and isolated test-only policy override; production Client SSRF/TLS protections are not relaxed. This is **not** a direct public-DNS/public-CA or production deployment test. Historical RC1 Client ↔ 0.2.0 Server evidence remains [in Step 30](https://github.com/cuichangquan/a2a-rails/issues/117).
225
+
226
+ ## What is a2a-rails?
227
+
228
+ `a2a-rails` provides inbound Server and outbound Client APIs for Rails applications.
229
+
230
+ ```text
231
+ A2A Protocol
232
+ ↓
233
+ Ruby A2A SDK
234
+ ↓
235
+ a2a-rails
236
+ ↓
237
+ Rails Application
238
+ ↓
239
+ Business Logic
240
+ ```
241
+
242
+ The Gem provides:
243
+
244
+ - a Rails-native Agent / Skill DSL;
245
+ - A2A Agent Card generation;
246
+ - automatically mounted A2A HTTP endpoints;
247
+ - synchronous Task execution by default, plus opt-in ActiveJob-backed async Task execution in published `0.2.0`;
248
+ - SDK-independent Handler inputs;
249
+ - a process-local MemoryStore by default, plus an optional durable ActiveRecordStore in `0.2.0`;
250
+ - Rails generators for initial setup;
251
+ - an internal Protocol Adapter boundary around the upstream SDK;
252
+ - **in 0.3.x**, a Rails outbound `A2A::Rails::Client` with strict HTTPS Agent Card discovery, A2A v1.0 JSON-RPC communication and optional Client-only mode.
253
+
254
+ The current release supports Server and Client use and remains **non-streaming**.
255
+
256
+ > [!WARNING]
257
+ > **Versioned security note:** The original **v0.1.0** did not implement per-caller Task authorization. **0.2.0 and the subsequent 0.3.x line** include a host-owned authentication hook, principal-scoped Task operations and fail-closed non-development/test behavior. **Neither version supplies your identity provider or business authorization, and publication does not approve an anonymously exposed production endpoint.** See [SECURITY.md](SECURITY.md), [authentication guide](docs/guides/authentication.md) and [deployment #11](https://github.com/cuichangquan/a2a-rails/issues/11).
224
258
 
225
259
  ## Public Rails API
226
260
 
@@ -264,7 +298,7 @@ For multiple Skills, the application supplies a Router. The Router receives `ski
264
298
 
265
299
  ## HTTP Endpoints
266
300
 
267
- The Gem automatically exposes:
301
+ With Server enabled (the default), the Gem automatically exposes:
268
302
 
269
303
  ```text
270
304
  GET /.well-known/agent-card.json
@@ -294,7 +328,6 @@ Rate limiting, application-specific authorization and production deployment safe
294
328
 
295
329
  Do **not** interpret successful source-tree CI or a merge to `main` as publication of a new RubyGems release.
296
330
 
297
-
298
331
  ## Agent Card
299
332
 
300
333
  Agent Cards are generated from the Agent / Skill DSL.
@@ -309,6 +342,17 @@ Behavior in v0.1:
309
342
  - Streaming, Push Notifications, and Extended Agent Cards are disabled;
310
343
  - generated Cards pass the `agent2agent 2.0.0` Agent Card schema.
311
344
 
345
+ ### Structured Data input (unreleased 0.4.0 candidate)
346
+
347
+ Declare `input_modes: ["application/json"]` on each Skill that accepts Data.
348
+ The selected Skill receives a normal Ruby Hash containing the JSON object, with
349
+ its original string keys and nested values intact. A Router selects a Skill
350
+ before this opt-in is checked; sending Data alone does not select a Skill
351
+ automatically. Legacy text-only handlers do not receive Data. See the
352
+ [structured Data guide](docs/guides/structured-data.md) for a complete Handler,
353
+ Client call, storage behavior and limits. Published 0.3.0 does not accept
354
+ inbound Data.
355
+
312
356
  ## Task Lifecycle
313
357
 
314
358
  Internally, `a2a-rails` keeps SDK-independent Task states:
@@ -417,7 +461,7 @@ lib/generators/a2a/rails/
417
461
  └── templates/
418
462
  ```
419
463
 
420
- ## v0.1 Scope
464
+ ## Historical v0.1 scope
421
465
 
422
466
  Included:
423
467
 
@@ -454,7 +498,7 @@ Not included in v0.1:
454
498
  - LLM Agent Framework
455
499
  - Orchestration Framework
456
500
 
457
- ## Verification
501
+ ## Historical v0.1.0 verification
458
502
 
459
503
  The v0.1.0 release candidate completed:
460
504
 
@@ -518,9 +562,34 @@ The CI matrix covers:
518
562
 
519
563
  Known warning-enabled output from upstream `agent2agent 2.0.0` can include circular-require, indentation, and URI-parser warnings. Those warnings are distinct from the Rack-environment INFO logging that `a2a-rails` suppresses at the Rails-facing adapter boundary.
520
564
 
521
- ## Release Documents
565
+ ## Release history and evidence
566
+
567
+ > **Historical v0.3.0.rc1 pre-release (2026-10-10):** `0.3.0.rc1` is published on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.3.0.rc1) and as a [GitHub Pre-release](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0-rc1). It adds the outbound Rails Client and Client-only mode. Stable `0.2.0` remains available. RC1 is not stable `0.3.0`, an independent audit, or public-production approval; see the [publication record](docs/release/v0.3.0-rc1-publication-record.md) and [Client guide](docs/guides/outbound-a2a-client.md).
568
+
569
+ > **Release status (2026-10-08):** **`0.2.0` is published as a stable release** on [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.2.0) and [GitHub](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0). It includes the Rails/Zeitwerk and migration-generator fixes after rc2. The public Gem matches the verified artifact byte-for-byte; see the [publication record](docs/release/v0.2.0-publication-record.md).
570
+
571
+ - RubyGems: https://rubygems.org/gems/a2a-rails
572
+ - **Current stable `0.3.0`:** [GitHub Release](https://github.com/cuichangquan/a2a-rails/releases/tag/v0.3.0) · [RubyGems](https://rubygems.org/gems/a2a-rails/versions/0.3.0) · [exact public SHA256 and provenance](docs/release/v0.3.0-publication-record.md)
573
+ - Published version list: https://rubygems.org/gems/a2a-rails/versions
574
+ - Earlier stable release `0.2.0`: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.2.0
575
+ - Previous stable release: https://github.com/cuichangquan/a2a-rails/releases/tag/v0.1.0
576
+ - Changelog: [CHANGELOG.md](CHANGELOG.md)
577
+ - Release record: [v0.3.0 publication record](docs/release/v0.3.0-publication-record.md) · [historical v0.2.0 publication record](docs/release/v0.2.0-publication-record.md)
578
+ - **Security policy / 脆弱性報告:** [SECURITY.md](SECURITY.md) — confidential vulnerability reporting, current assurance boundaries and production responsibilities.
579
+ - **v0.3.x prerelease policy:** [Risk-based release gates](docs/release/step-29-5u-risk-based-oss-release-policy.md) — independently commissioned external audit is **recommended but optional**, not a known vulnerability or RubyGems requirement. Technical security checks, no known unresolved Critical/High findings, exact Gem provenance and explicit maintainer release approval remain mandatory; [optional community review #113](https://github.com/cuichangquan/a2a-rails/issues/113). **Check the published-version list for the current stable version; package publication and public-production deployment are separate decisions.**
580
+ - **Release evidence & upgrading:** [Step 31 release-readiness record](docs/release/v0.3.0-stable-readiness.md) · [RC1 feedback snapshot](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md) · [v0.2.0 → v0.3.0 upgrade guide](docs/release/upgrading-v0.2.0-to-v0.3.md) · [v0.1.0 → v0.2.0 guide](docs/release/upgrading-v0.1.0-to-v0.2.md). Check [RubyGems](https://rubygems.org/gems/a2a-rails/versions) for availability. Gem distribution does **not** authorize public Agent exposure.
581
+ - **低コスト検証 / Cost-efficient verification:** [Step 33 validation levels, offline decision helper and read-only GCP inventory](docs/testing/cost-efficient-validation.md) — reuse existing CI before new billable infrastructure; cloud operations require separate approval.
582
+ - **Roadmap / 次にやること:** [ROADMAP.md](ROADMAP.md) · [Step 31 / Issue #120](https://github.com/cuichangquan/a2a-rails/issues/120) for the `0.3.0` release-evaluation and publication decisions. [Issue #11](https://github.com/cuichangquan/a2a-rails/issues/11) still governs public-production deployment; the [historical `0.2.0` release record](docs/release/v0.2.0-stable-readiness.md) is separate.
583
+ - **Official A2A TCK results:** [Pinned JSON-RPC MUST report and reproduction](docs/testing/official-a2a-tck.md) — after Step 17-4: **63 passed / 1 failed / 171 skipped / 30 deselected** (pytest). The remaining `CORE-SEND-003` mismatch is tracked [upstream in #202](https://github.com/a2aproject/a2a-tck/issues/202). The TCK workflow is informational, **not** an A2A conformance certificate.
584
+
585
+ - [A2Aの全体像(日本語・A4 1枚PDF)](docs/guides/a2a-protocol-overview-ja.pdf) — 登場人物・依頼の流れ・主要用語・MCPとの違いをまとめた学習資料。
586
+ - [A2A at a glance (English, A4 one-page PDF)](docs/guides/a2a-protocol-overview-en.pdf) — Roles, workflow, key terms, and how MCP fits.
522
587
 
523
588
  - [CHANGELOG](CHANGELOG.md)
589
+ - [Historical 0.3.0 pre-publication readiness](docs/release/v0.3.0-stable-readiness.md)
590
+ - [Step 31-4 RC1 feedback evidence and risks](docs/release/v0.3.0-rc1-feedback-and-upgrade-readiness.md)
591
+ - [Upgrading from v0.2.0 to v0.3.0](docs/release/upgrading-v0.2.0-to-v0.3.md)
592
+ - [RC1 feedback / bug report template](https://github.com/cuichangquan/a2a-rails/issues/new?template=rc1-feedback.md)
524
593
  - [v0.1.0 Release Notes](docs/release/v0.1.0.md)
525
594
  - [v0.1.0 Release Checklist](docs/release/v0.1.0-checklist.md)
526
595
  - [v0.1.0 Release Record](docs/release/v0.1.0-record.md)
@@ -537,6 +606,13 @@ Known warning-enabled output from upstream `agent2agent 2.0.0` can include circu
537
606
 
538
607
  The Gem is available as open source under the terms of the MIT License. See [LICENSE](LICENSE).
539
608
 
609
+ ## Protocol illustrations
610
+
611
+ <img src="docs/assets/a2a-rails-infographics.png">
612
+ <br/>
613
+ <br/>
614
+ <img src="docs/assets/a2a-rails-infographics-en.png">
615
+
540
616
  ## Official A2A Resources / A2A公式資料
541
617
 
542
618
  - [A2A Protocol overview / A2Aの全体像(日本語・A4 1枚PDF)](docs/guides/a2a-protocol-overview-ja.pdf) — 公式資料をもとに作成した学習資料(2026-10-07)。
@@ -183,7 +183,8 @@ module A2A
183
183
  end
184
184
  validate_remote_protocol_keys!(part, operation)
185
185
  type = kinds.find { |key| part.key?(key) }
186
- valid_value = type == "data" ? part[type].is_a?(Hash) : part[type].is_a?(String)
186
+ value = part[type]
187
+ valid_value = type == "data" ? value.is_a?(Hash) || value.is_a?(Array) : value.is_a?(String)
187
188
  unless valid_value
188
189
  raise InvalidResponseError.new(:invalid_message_part, operation: operation)
189
190
  end
@@ -27,6 +27,7 @@ module A2A
27
27
  def plan(message:, context:)
28
28
  validate!
29
29
  skill = select_skill(message: message, context: context)
30
+ verify_skill_input!(skill, message)
30
31
 
31
32
  ExecutionPlan.new(
32
33
  agent_class_name: @agent.name,
@@ -38,6 +39,7 @@ module A2A
38
39
  def execute(plan:, message:, context:)
39
40
  validate!
40
41
  skill = declared_skill(plan.skill_id)
42
+ verify_skill_input!(skill, message)
41
43
  handler_context = context.merge(skill_id: skill.id)
42
44
 
43
45
  skill.handler.call(message: message, context: handler_context)
@@ -64,6 +66,14 @@ module A2A
64
66
  declared_skill(selected_id, selected)
65
67
  end
66
68
 
69
+ def verify_skill_input!(skill, message)
70
+ parts = message[:parts] if message.is_a?(Hash)
71
+ return unless parts.is_a?(Array) && parts.any? { |part| part.is_a?(Hash) && part.key?(:data) }
72
+ return if skill.input_modes&.include?(Skill::DATA_INPUT_MODE)
73
+
74
+ raise UnsupportedSkillInputError, "Selected skill does not accept JSON Data Parts"
75
+ end
76
+
67
77
  def declared_skill(skill_id, original = skill_id)
68
78
  @agent.skills.find { |skill| skill.id == skill_id } ||
69
79
  raise(UnknownSkillError, "Router selected unknown skill: #{original.inspect}")
@@ -9,6 +9,7 @@ module A2A
9
9
  class UnknownSkillError < ConfigurationError; end
10
10
 
11
11
  class RejectedTask < Error; end
12
+ class UnsupportedSkillInputError < RejectedTask; end
12
13
  class ArtifactMappingError < Error; end
13
14
 
14
15
  class ProtocolError < Error; end
@@ -5,6 +5,7 @@ require "rack"
5
5
  require "stringio"
6
6
  require_relative "adapter"
7
7
  require_relative "task_mapper"
8
+ require_relative "part_data"
8
9
 
9
10
  module A2A
10
11
  module Rails
@@ -90,7 +91,14 @@ module A2A
90
91
  request = env.fetch("a2a.request")
91
92
  validate_request!(request)
92
93
 
93
- result = @request_handler.call(operation: operation, params: request.to_h)
94
+ params = request.to_h
95
+ if operation == "SendMessage"
96
+ # The binding retains the parsed original params before Definition
97
+ # recursively removes nil values. Preserve Data only after the
98
+ # usual SDK validation; Rails still validates its input contract.
99
+ params = PartData.restore_request(params, env["a2a.body"])
100
+ end
101
+ result = @request_handler.call(operation: operation, params: params)
94
102
  schema(RESPONSE_SCHEMAS.fetch(operation), result)
95
103
  rescue A2A::Rails::TaskNotFoundError => error
96
104
  raise A2A::TaskNotFoundError.new(error.task_id)
@@ -128,7 +136,9 @@ module A2A
128
136
  def schema(name, value)
129
137
  object = A2A::Protocol::JsonSchema[name].new(value)
130
138
  object.valid!
131
- object
139
+ # Return the SDK-normalized protocol shape, with only opaque Data
140
+ # restored. The SDK binding remains responsible for JSON-RPC output.
141
+ PartData.restore_response(name, object.to_h, value)
132
142
  end
133
143
  end
134
144
  end
@@ -0,0 +1,89 @@
1
+ # frozen_string_literal: true
2
+
3
+ module A2A
4
+ module Rails
5
+ module Protocol
6
+ # Local compatibility boundary for agent2agent 2.0's recursive nil
7
+ # compaction. Protocol fields still use the SDK's normalization; only
8
+ # Part content is restored from the original plain-Ruby representation.
9
+ # In particular, this does not change metadata serialization.
10
+ module PartData
11
+ CONTENT_FIELDS = %w[text data raw url].freeze
12
+
13
+ module_function
14
+
15
+ def restore_request(params, original)
16
+ return params unless params.is_a?(Hash) && original.is_a?(Hash)
17
+
18
+ restore_message(params["message"], original["message"], request: true)
19
+ params
20
+ end
21
+
22
+ def restore_response(name, normalized, original)
23
+ case name
24
+ when "Send Message Response"
25
+ restore_message(normalized["message"], original["message"])
26
+ restore_task(normalized["task"], original["task"])
27
+ when "Task"
28
+ restore_task(normalized, original)
29
+ when "List Tasks Response"
30
+ each_pair(normalized["tasks"], original["tasks"]) do |task, source|
31
+ restore_task(task, source)
32
+ end
33
+ end
34
+ normalized
35
+ end
36
+
37
+ def restore_task(task, original)
38
+ return unless task.is_a?(Hash) && original.is_a?(Hash)
39
+
40
+ each_pair(task["history"], original["history"]) do |message, source|
41
+ restore_message(message, source)
42
+ end
43
+ each_pair(task["artifacts"], original["artifacts"]) do |artifact, source|
44
+ restore_message(artifact, source)
45
+ end
46
+ status = task["status"]
47
+ source_status = original["status"]
48
+ if status.is_a?(Hash) && source_status.is_a?(Hash)
49
+ restore_message(status["message"], source_status["message"])
50
+ end
51
+ end
52
+
53
+ def restore_message(message, original, request: false)
54
+ return unless message.is_a?(Hash) && original.is_a?(Hash)
55
+
56
+ each_pair(message["parts"], original["parts"]) do |part, source|
57
+ next unless part.is_a?(Hash) && source.is_a?(Hash)
58
+
59
+ # Preserve original kind-field presence so the Rails input contract
60
+ # can reject ambiguous Parts even when one field is JSON null.
61
+ fields = request ? CONTENT_FIELDS : ["data"]
62
+ fields.each { |field| part[field] = copy(source[field]) if source.key?(field) }
63
+ next unless request && source.key?("data")
64
+
65
+ # Accept the same alternate spelling as the SDK, but avoid
66
+ # choosing a Data media type based on field order.
67
+ keys = %w[mediaType media_type].select { |key| source.key?(key) }
68
+ if keys.size > 1
69
+ raise InvalidRequestError, "Data Part must not specify mediaType more than once"
70
+ end
71
+ part["mediaType"] = source.fetch(keys.first) if keys.one?
72
+ end
73
+ end
74
+
75
+ def each_pair(values, originals)
76
+ return unless values.is_a?(Array) && originals.is_a?(Array)
77
+
78
+ values.each_with_index { |value, index| yield value, originals[index] }
79
+ end
80
+
81
+ def copy(value)
82
+ Marshal.load(Marshal.dump(value))
83
+ end
84
+
85
+ private_class_method :restore_task, :restore_message, :each_pair, :copy
86
+ end
87
+ end
88
+ end
89
+ end
@@ -43,11 +43,27 @@ module A2A
43
43
  return send_direct_message(message, context_id)
44
44
  end
45
45
 
46
- task = @lifecycle.create(message: message, context_id: context_id)
46
+ preflight = nil
47
+ routing_error = nil
48
+ task = @lifecycle.create(message: message, context_id: context_id) do |draft|
49
+ next unless message.fetch(:parts).any? { |part| part.key?(:data) }
50
+
51
+ # The router gets the final task context, but unsupported Data
52
+ # must not create a Task or consume the owner's storage quota.
53
+ begin
54
+ preflight = @dispatcher.plan(message: message, context: execution_context(draft))
55
+ rescue UnsupportedSkillInputError => error
56
+ raise ContentTypeNotSupportedError, error.message
57
+ rescue StandardError => error
58
+ routing_error = error
59
+ end
60
+ end
47
61
  context = execution_context(task)
48
62
 
49
63
  plan = begin
50
- @dispatcher.plan(message: message, context: context)
64
+ raise routing_error if routing_error
65
+
66
+ preflight || @dispatcher.plan(message: message, context: context)
51
67
  rescue RejectedTask => error
52
68
  task = @lifecycle.reject(task.fetch(:id), error)
53
69
  nil
@@ -121,6 +137,8 @@ module A2A
121
137
  context: { task_id: nil, context_id: context_id }
122
138
  )
123
139
  { "message" => @task_mapper.dump_direct_message(result, context_id: context_id) }
140
+ rescue UnsupportedSkillInputError => error
141
+ raise ContentTypeNotSupportedError, error.message
124
142
  rescue StandardError
125
143
  # No Task exists to record a FAILED status. Never send application
126
144
  # exception details or unsupported result values to A2A callers.
@@ -199,7 +217,10 @@ module A2A
199
217
  raise TaskContinuationNotSupportedError, "Task continuation is not supported in v0.1"
200
218
  end
201
219
 
202
- normalized_parts = parts.map { |part| normalize_text_part(part) }
220
+ normalized_parts = parts.map { |part| normalize_part(part) }
221
+ if normalized_parts.any? { |part| part.key?(:data) } && normalized_parts.any? { |part| part.key?(:text) }
222
+ raise ContentTypeNotSupportedError, "Text and JSON Data Parts cannot be mixed in one Message"
223
+ end
203
224
  message = {
204
225
  message_id: message_id,
205
226
  role: :user,
@@ -210,27 +231,55 @@ module A2A
210
231
  [message, context_id]
211
232
  end
212
233
 
213
- def normalize_text_part(part)
214
- unless part.is_a?(Hash) && part["text"].is_a?(String) && (part.keys & %w[data raw url]).empty?
215
- raise ContentTypeNotSupportedError, "Only text Parts are supported in v0.1"
234
+ def normalize_part(part)
235
+ types = part.is_a?(Hash) ? part.keys & %w[text data raw url] : []
236
+ if types.size > 1
237
+ raise InvalidRequestError, "Each Part must specify exactly one content kind"
216
238
  end
217
- media_type = part["mediaType"]
218
- unless media_type.nil? || media_type.is_a?(String)
219
- raise InvalidRequestError, "mediaType must be a String"
239
+
240
+ normalized = case types.first
241
+ when "data"
242
+ normalize_data_part(part)
243
+ when "text"
244
+ normalize_text_part(part)
245
+ else
246
+ raise ContentTypeNotSupportedError, "Only text and JSON Data Parts are supported"
220
247
  end
248
+
221
249
  metadata = part["metadata"]
222
250
  unless metadata.nil? || metadata.is_a?(Hash)
223
251
  raise InvalidRequestError, "part metadata must be an object"
224
252
  end
225
-
226
- normalized = {
227
- text: part["text"],
228
- media_type: part["mediaType"].to_s.empty? ? "text/plain" : part["mediaType"]
229
- }
230
253
  normalized[:metadata] = copy(metadata) if metadata
231
254
  normalized
232
255
  end
233
256
 
257
+ def normalize_data_part(part)
258
+ data = part["data"]
259
+ unless data.is_a?(Hash)
260
+ raise InvalidRequestError, "Data Part input must be a JSON object"
261
+ end
262
+
263
+ media_type = part.fetch("mediaType", Skill::DATA_INPUT_MODE)
264
+ unless media_type == Skill::DATA_INPUT_MODE
265
+ raise ContentTypeNotSupportedError, "Data Part mediaType must be application/json when specified"
266
+ end
267
+
268
+ { data: copy(data), media_type: media_type }
269
+ end
270
+
271
+ def normalize_text_part(part)
272
+ unless part["text"].is_a?(String)
273
+ raise ContentTypeNotSupportedError, "Text Part content must be a String"
274
+ end
275
+
276
+ media_type = part["mediaType"]
277
+ unless media_type.nil? || media_type.is_a?(String)
278
+ raise InvalidRequestError, "mediaType must be a String"
279
+ end
280
+ { text: part["text"], media_type: media_type.to_s.empty? ? "text/plain" : media_type }
281
+ end
282
+
234
283
  def validate_list_filters!(params)
235
284
  if params.key?("contextId") && !params["contextId"].nil? && !params["contextId"].is_a?(String)
236
285
  raise InvalidRequestError, "contextId must be a String"
@@ -104,7 +104,7 @@ module A2A
104
104
  result["raw"] = part[:raw] if part.key?(:raw)
105
105
  result["url"] = part[:url] if part.key?(:url)
106
106
  result["filename"] = part[:filename] if part.key?(:filename)
107
- if part.key?(:raw) || part.key?(:url)
107
+ if part.key?(:raw) || part.key?(:url) || part.key?(:data)
108
108
  result["mediaType"] = part[:media_type] if part.key?(:media_type)
109
109
  end
110
110
  result["metadata"] = copy(part[:metadata]) if part.key?(:metadata)
@@ -3,6 +3,8 @@
3
3
  module A2A
4
4
  module Rails
5
5
  class Skill
6
+ DATA_INPUT_MODE = "application/json"
7
+
6
8
  attr_reader :id, :name, :description, :tags, :handler, :examples, :input_modes, :output_modes, :execution_mode
7
9
 
8
10
  def initialize(id:, description:, tags:, handler:, name: nil, examples: nil, input_modes: nil, output_modes: nil, execution_mode: nil)
@@ -413,11 +413,38 @@ module A2A
413
413
  }
414
414
 
415
415
  task[:status][:message] = deep_symbolize(record.status_message) unless record.status_message.nil?
416
- task[:history] = deep_symbolize(record.history) unless record.history.nil?
417
- task[:artifacts] = deep_symbolize(record.artifacts) unless record.artifacts.nil?
416
+ task[:history] = deserialize_part_entries(record.history) unless record.history.nil?
417
+ task[:artifacts] = deserialize_part_entries(record.artifacts) unless record.artifacts.nil?
418
418
  task
419
419
  end
420
420
 
421
+ # The persistence envelope uses Ruby symbols; JSON inside the data
422
+ # field of a protocol Part is opaque. Do not treat a key named "data"
423
+ # inside metadata (or inside another arbitrary object) as a Part.
424
+ def deserialize_part_entries(entries)
425
+ return deep_symbolize(entries) unless entries.is_a?(Array)
426
+
427
+ entries.map do |entry|
428
+ next deep_symbolize(entry) unless entry.is_a?(Hash)
429
+
430
+ entry.each_with_object({}) do |(key, value), result|
431
+ result[key.to_sym] = if key == "parts" && value.is_a?(Array)
432
+ value.map { |part| deserialize_part(part) }
433
+ else
434
+ deep_symbolize(value)
435
+ end
436
+ end
437
+ end
438
+ end
439
+
440
+ def deserialize_part(part)
441
+ return deep_symbolize(part) unless part.is_a?(Hash)
442
+
443
+ part.each_with_object({}) do |(key, value), result|
444
+ result[key.to_sym] = key == "data" ? value : deep_symbolize(value)
445
+ end
446
+ end
447
+
421
448
  def deep_stringify(value)
422
449
  case value
423
450
  when Hash
@@ -28,6 +28,7 @@ module A2A
28
28
  history: [copy(message)]
29
29
  }
30
30
 
31
+ yield task if block_given?
31
32
  @store.save(task)
32
33
  end
33
34
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module A2A
4
4
  module Rails
5
- VERSION = "0.3.0.rc1"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a2a-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.rc1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - cuichangquan
@@ -67,6 +67,9 @@ dependencies:
67
67
  name: json
68
68
  requirement: !ruby/object:Gem::Requirement
69
69
  requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 2.19.9
70
73
  - - "<"
71
74
  - !ruby/object:Gem::Version
72
75
  version: '3'
@@ -74,6 +77,9 @@ dependencies:
74
77
  prerelease: false
75
78
  version_requirements: !ruby/object:Gem::Requirement
76
79
  requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.19.9
77
83
  - - "<"
78
84
  - !ruby/object:Gem::Version
79
85
  version: '3'
@@ -238,6 +244,7 @@ files:
238
244
  - lib/a2a/rails/file_artifact.rb
239
245
  - lib/a2a/rails/protocol/adapter.rb
240
246
  - lib/a2a/rails/protocol/agent2agent_adapter.rb
247
+ - lib/a2a/rails/protocol/part_data.rb
241
248
  - lib/a2a/rails/protocol/request_handler.rb
242
249
  - lib/a2a/rails/protocol/task_mapper.rb
243
250
  - lib/a2a/rails/request_guard.rb