ruby_llm-ag_ui 0.3.0 → 1.0.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +70 -0
  3. data/CONTRIBUTING.md +4 -0
  4. data/README.md +2 -2
  5. data/docs/_advanced/client-example.md +7 -0
  6. data/docs/_advanced/provider-verification.md +70 -0
  7. data/docs/_advanced/rails-integration.md +9 -1
  8. data/docs/_advanced/security-and-deployment.md +2 -2
  9. data/docs/_core_features/approval-and-resume.md +9 -0
  10. data/docs/_core_features/reconnects.md +15 -0
  11. data/docs/_core_features/streaming-runs.md +9 -1
  12. data/docs/_getting_started/configuration.md +7 -2
  13. data/docs/_getting_started/getting-started.md +1 -1
  14. data/docs/_getting_started/overview.md +2 -1
  15. data/docs/_getting_started/whats-new-in-1-0.md +103 -0
  16. data/docs/_reference/api-reference.md +2 -1
  17. data/docs/_reference/compatibility.md +211 -8
  18. data/docs/_reference/protocol-coverage.md +1 -1
  19. data/docs/_reference/public-api.md +103 -0
  20. data/docs/_reference/release-history.md +3 -1
  21. data/docs/_reference/releasing.md +5 -0
  22. data/docs/_reference/upgrading.md +46 -27
  23. data/docs/{_getting_started → _reference}/whats-new-in-0-3.md +2 -1
  24. data/docs/_reference/whats-new-in-0-4.md +58 -0
  25. data/lib/ruby_llm/ag_ui/configuration.rb +16 -12
  26. data/lib/ruby_llm/ag_ui/emitter.rb +1 -1
  27. data/lib/ruby_llm/ag_ui/error_sanitizer.rb +1 -1
  28. data/lib/ruby_llm/ag_ui/immutable.rb +34 -0
  29. data/lib/ruby_llm/ag_ui/input.rb +12 -6
  30. data/lib/ruby_llm/ag_ui/interrupt.rb +10 -10
  31. data/lib/ruby_llm/ag_ui/mapper.rb +60 -15
  32. data/lib/ruby_llm/ag_ui/message_parser.rb +1 -1
  33. data/lib/ruby_llm/ag_ui/rails/active_record_store.rb +18 -9
  34. data/lib/ruby_llm/ag_ui/rails/streaming.rb +8 -2
  35. data/lib/ruby_llm/ag_ui/reconnect.rb +1 -1
  36. data/lib/ruby_llm/ag_ui/redaction.rb +3 -1
  37. data/lib/ruby_llm/ag_ui/resume.rb +1 -1
  38. data/lib/ruby_llm/ag_ui/resume_entry.rb +3 -3
  39. data/lib/ruby_llm/ag_ui/run.rb +18 -13
  40. data/lib/ruby_llm/ag_ui/run_record.rb +10 -10
  41. data/lib/ruby_llm/ag_ui/sse_writer.rb +20 -3
  42. data/lib/ruby_llm/ag_ui/store/memory_store.rb +3 -3
  43. data/lib/ruby_llm/ag_ui/validation.rb +1 -1
  44. data/lib/ruby_llm/ag_ui/version.rb +1 -1
  45. metadata +9 -4
@@ -23,11 +23,11 @@ dependency does.
23
23
 
24
24
  | Component | Range | Evidence |
25
25
  |---|---|---|
26
- | Ruby | `>= 3.2` | Recorded 0.3 CI passes on 3.2.11, 3.3.12, and 3.4.11 |
27
- | RubyLLM | `>= 2.1`, `< 3.0` | 2.1.1 (callback, approval and cancellation behavior read from its source) |
26
+ | Ruby | `>= 3.3` | Recorded 0.4 CI passes on 3.3.12 and 3.4.11; 4.0.9 passes locally, and CI now includes 4.0. Ruby 3.2 is no longer supported |
27
+ | RubyLLM | `>= 2.1`, `< 3.0` | 2.1.0 and 2.1.1 pass the 0.4 CI matrix; the recorded live session uses 2.1.1 |
28
28
  | `ag-ui-protocol` | `~> 0.2.0` | 0.2.0 |
29
29
  | JSON | `>= 2.0`, `< 3` | 2.21.2 passes both Rails lines; JSON 3 removes the `quirks_mode` option used by Rails 8.0 |
30
- | Rails (adapter only) | `railties`, `actionpack`, `activerecord` `>= 8.0` | Recorded 0.3 CI passes on 8.0.5.1 and 8.1.4 with Ruby 3.3/3.4 |
30
+ | Rails (adapter only) | `railties`, `actionpack`, `activerecord` `>= 8.0` | Recorded 0.4 CI passes on 8.0.5.1 and 8.1.4 with Ruby 3.3/3.4; both pass locally on Ruby 4.0.9 |
31
31
  | AG-UI schema | pinned commit `89cedd3fd549feeee41e50e1d7c6d373e549241a` | vendored, SHA-256 recorded in [AG-UI Protocol Coverage]({% link _reference/protocol-coverage.md %}) |
32
32
 
33
33
  The pure-Ruby core uses `ruby_llm` and `ag-ui-protocol`, plus the patched
@@ -44,6 +44,8 @@ adapter is only loaded when `Rails::Railtie` is already defined.
44
44
  | The 31-type coverage map is the schema's own union | `spec/ruby_llm/ag_ui/coverage_spec.rb` compares the pinned list with `Coverage`, and the SDK enum at runtime |
45
45
  | The SDK's five legacy `THINKING_*` constants are never counted as 1.0 | the same spec asserts `LEGACY_SDK_ONLY` is absent from the map |
46
46
  | Text, tool and lifecycle sequences are ordered and closed | mapper specs, including partial arguments, a nil chunk, a tool that raises, and a thinking-only chunk |
47
+ | Streamed tool arguments join to valid JSON for each call | `spec/integration/streamed_tool_calls_spec.rb` runs a real RubyLLM chat over intercepted Chat Completions, Responses, Anthropic, and Gemini streams, including two tool rounds in one turn |
48
+ | A Rails boot does not load Active Record through the gem | `spec/integration/core_load_spec.rb` requires the gem after the Active Record railtie in a subprocess |
47
49
  | One outcome per run, and the outcome matches what happened | run specs: success, interrupt, cancelled, sanitized failure, unsupported pause |
48
50
  | `requires_approval` → interrupt → resume executes the tool once | run specs drive a fake chat through the pause, approve, deny, replay and expiry cases |
49
51
  | Identity is reserved, replayed and never re-executed | store specs (memory and ActiveRecord), run specs for conflict, reconnect and live-run refusal |
@@ -54,6 +56,197 @@ adapter is only loaded when `Rails::Railtie` is already defined.
54
56
 
55
57
  The RSpec suite runs offline with fakes and no provider credentials. Package verification uses the network only to install dependencies, then runs its core and Rails checks without a provider. Its advisory check includes the actual default-library gem versions activated by the isolated core install.
56
58
 
59
+ ## 1.0.0 Release Evidence
60
+
61
+ Version 1.0.0 was rehearsed as the local, unpublished candidate 1.0.0.rc.1 and
62
+ published after the maintainer's acceptance. The dated reviews below record that
63
+ candidate. The 2026-10-21 evidence records the earlier rehearsal.
64
+
65
+ ### Release Verification on 2026-11-02
66
+
67
+ The 1.0.0 release commit passes 321 offline examples with zero failures and two
68
+ opt-in live checks skipped on Ruby 3.3.5, and lint passes on 100 files. The
69
+ browser suite passes 18 workflows with all 242 consumed events schema-valid. The
70
+ built gem passes both installed endpoints, clean core and Rails installation with
71
+ the generator migrated up and down, and the activated-dependency advisory check.
72
+ The upgrade from the published 0.4.0 artifact keeps the generated files,
73
+ reconnects, runs an approval once, and denies with no effect.
74
+
75
+ The OpenRouter rerun passes live streamed text and approval with reconnect, plus
76
+ the offline and intercepted harness cases: six examples, zero failures.
77
+
78
+ The development bundle audit uses 1,307 advisories at
79
+ `79c0e052ade15d29d3ecc1e8d4fa59c337a86383`. Advisories published on 2026-11-01
80
+ affected `addressable`, `rack`, and `sqlite3` in the development and test bundle
81
+ only; after updating them to 2.9.2, 3.2.8, and 2.10.2 the audit reports no
82
+ findings. None is a runtime dependency of the gem. The npm audit reports zero
83
+ findings.
84
+
85
+ ### Candidate Review on 2026-11-02
86
+
87
+ A review of every change since 0.4.0 found one more streamed tool-call defect.
88
+ RubyLLM starts a new call for each fragment that carries an id, but the mapper
89
+ continued the call already at that stream index. An OpenAI-compatible server
90
+ that sends each parallel call whole at index 0 had the second call's arguments
91
+ appended to the first. A real-chat intercepted-HTTP spec fails before the fix.
92
+
93
+ The offline suite passes 321 examples with zero failures and two opt-in live
94
+ checks skipped on Ruby 3.3.5, and lint passes on 100 files. Ruby 4.0.9 passes the
95
+ same 321 examples twice: with RubyLLM 2.1.1 and Rails 8.1.4, and with RubyLLM
96
+ 2.1.0 and Rails 8.0.5.1. Malformed-input refusal holds on JSON 2.7.1, 2.9.1, and
97
+ 2.21.2. CI adds Ruby 4.0 to the core and Rails matrices; its remote results are
98
+ separate evidence.
99
+
100
+ The fix changes a packaged file, so the 2026-10-26 artifact below is superseded.
101
+ The rebuilt candidate passes the installed-host checks for both endpoints and the
102
+ generated RubyLLM models. Its upgrade from the published 0.4.0 artifact keeps the
103
+ generated files, reconnects, runs an approval once, and denies with no effect.
104
+ The browser suite passes 18 workflows with all 242 consumed events schema-valid;
105
+ desktop approval progress and 390px mobile denial screenshots were inspected.
106
+
107
+ ### Final Local Review on 2026-10-26
108
+
109
+ The offline suite passes 320 examples with zero failures and two opt-in live
110
+ checks skipped, on Ruby 3.3.5 with RubyLLM 2.1.1 and Rails 8.1.4. Line coverage
111
+ is 97.58 percent; this measures executed lines rather than complete behavior.
112
+ The same 320 examples pass separately on the minimum RubyLLM 2.1.0.
113
+ Lint passes on 100 files. Added regressions cover SSE quality and wildcard
114
+ precedence, empty media parameters, and actual Rails requests without Active
115
+ Record. Known missing-record errors still return 404; unrelated host errors
116
+ propagate. The focused tests reproduce the defects before their fixes.
117
+
118
+ The client still uses `@ag-ui/client` 1.0.3. After overriding Zod to 4.6.6,
119
+ 18 browser workflows pass with all 242 consumed events schema-valid. Desktop
120
+ approval progress and 390px mobile denial screenshots were inspected. The
121
+ 2026-10-26 npm audit reports zero findings. Before the override, the audit
122
+ reported four high findings from one transitive Zod advisory. This is a
123
+ development bundle, not a JavaScript dependency shipped with the Ruby gem.
124
+
125
+ The Ruby audit uses 1,269 advisories at
126
+ `03da937a9e171e3fedebde6620e203559b7a60c0` and reports no findings after updating
127
+ the local Rails dependency `crass` from 1.0.7 to 1.0.8. Existing applications
128
+ need their own lockfile audit; installing this gem does not audit a host's
129
+ Rails dependencies. CI now audits both the Ruby development bundle and npm.
130
+
131
+ `bin/verify-upgrade` preserves this rehearsal as a repeatable command. It
132
+ installs the published 0.4.0 artifact and the built candidate, then uses separate
133
+ processes against one temporary SQLite database. Generated files are unchanged;
134
+ 0.4 completed outcomes reconnect, old approvals execute once, denial executes
135
+ no effect, completed retries do not execute again, and scope isolation holds.
136
+ Its scripted chat and existing development dependencies are separate evidence
137
+ from clean installation and real-provider tests.
138
+
139
+ The bounded OpenRouter rerun passes both live text and approval/resume checks
140
+ with `openai/gpt-4.1-mini`, plus one offline harness case. No live browser,
141
+ Rails/provider, denial, cancellation-timing, or additional-provider claim is made.
142
+
143
+ ### Earlier Local Rehearsal on 2026-10-21
144
+
145
+ On 2026-10-21, the candidate passes 313 offline examples with zero failures
146
+ and two opt-in provider skips on Ruby 3.3.5, RubyLLM 2.1.1, and Rails 8.1.4.
147
+ Lint passes on 97 files. The browser suite passes 18 workflows with
148
+ `@ag-ui/client` 1.0.3 and validates all 242 consumed events. Desktop approval
149
+ and 390px mobile denial screenshots were inspected.
150
+
151
+ The built artifact passes both installed endpoints, the generated RubyLLM
152
+ models, a clean gem home with the activated-dependency audit, and Rails
153
+ generator migration up and down. The root advisory audit reports no findings.
154
+
155
+ An upgrade rehearsal installs the published 0.4.0 gem in an isolated gem home,
156
+ generates and migrates its table in SQLite, and records a succeeded run and an
157
+ interrupted run. The candidate artifact then reconnects to the 0.4 run without
158
+ executing it, resumes the 0.4 interrupt with the original call id, runs the
159
+ tool once, and reconnects without running it again. Its generated migration
160
+ and initializer match 0.4.0.
161
+
162
+ The rerun OpenRouter session uses `openai/gpt-4.1-mini` with RubyLLM 2.1.1.
163
+ Both live examples pass: streamed text, and the synthetic approval/resume with
164
+ reconnect. The same command runs four offline and intercepted harness examples,
165
+ for six examples and zero failures.
166
+
167
+ The audit for this candidate found streamed tool-call defects that the 0.4
168
+ evidence did not exercise: a second tool round in one turn, Anthropic and
169
+ Bedrock empty opening input, and Gemini whole-call arguments. Each defect has a
170
+ real-chat intercepted-HTTP spec that fails before its fix. Remote CI is separate
171
+ from that local record. No RC tag or publication is planned.
172
+
173
+ ## 0.4 Release Acceptance
174
+
175
+ The [2026-10-21 acceptance CI](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39518735488)
176
+ passes all 17 jobs at `e09b81b`. Each test job reports 296 examples, zero failures,
177
+ and two opt-in provider skips across the Ruby, Rails, and RubyLLM matrix below.
178
+ Local checks also pass 296 examples and lint on 95 files. Both installed
179
+ endpoints verify one original tool call and one result with its original id.
180
+
181
+ The added regressions cover `Run#record` on reconnect and real RubyLLM denial
182
+ without tool execution. Denial uses intercepted HTTP. The local OpenRouter
183
+ text and approval/resume examples are separately rerun on the release code:
184
+ two live cases plus one offline harness example pass with zero failures.
185
+
186
+ The browser suite again passes 18 workflows and validates all 242 consumed
187
+ events. Desktop approval progress and 390px mobile denial screenshots were
188
+ inspected. The earlier candidate record below retains its own commit and counts.
189
+
190
+ ### Published 0.4.0 Artifact
191
+
192
+ The [tag-source CI](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39518971268)
193
+ passes all 17 jobs at `23d9020`. The
194
+ [0.4.0 release workflow](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39519175592)
195
+ passes its offline, browser, advisory, installed-host, and clean-install checks.
196
+ The actual GitHub and RubyGems downloads have matching SHA-256 hashes, including
197
+ the release checksum and RubyGems metadata. All 66 packaged files match the tag.
198
+ The downloaded artifact independently passes both installed endpoints and fresh
199
+ core, activated-dependency audit, and Rails generator migration up/down checks.
200
+
201
+ The [stable documentation deployment](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39519565224)
202
+ passes. HTTP checks verify the stable guides, generated API, release history,
203
+ and stable/Next installation commands and `llms.txt`. A fresh browser session
204
+ shows 0.4.0 and switches to Next through the version menu; its screenshot was
205
+ inspected. Publication checks do not expand the provider or database claims below.
206
+
207
+ ## Local 0.4 Development Verification
208
+
209
+ On 2026-10-21, the candidate passes 294 offline examples with zero failures
210
+ and two opt-in provider checks skipped. Separate runs use RubyLLM 2.1.0 and
211
+ 2.1.1 on Ruby 3.3.5 with Rails 8.1.4 and JSON 2.21.2. The [0.4 candidate CI](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39515383346)
212
+ passes all 17 jobs at `14b3c15`: six Ruby jobs across 3.2.11, 3.3.12, and
213
+ 3.4.11 with both RubyLLM versions; eight Rails jobs across 8.0.5.1 and 8.1.4
214
+ on Ruby 3.3/3.4 with both versions; lint, installed-host, and browser checks.
215
+ Each suite reports 294 examples, zero failures, and two opt-in provider skips.
216
+
217
+ The maintained client passes 18 workflows and validates all 242 consumed
218
+ events. Approval assertions inspect the official client's messages as well as
219
+ the wire: one original call, one associated result, no duplicate visible text
220
+ after reconnect. The remote browser uses Chromium 156.0.8078.4; local and remote
221
+ desktop progress and 390px denial screenshots were inspected. The fixture now fires the same resumed before-tool callback
222
+ as a real RubyLLM chat. Installed-host and generated Rails model checks pass. A fixed local 66-file
223
+ artifact independently passes clean core loading, activated dependency audit,
224
+ and Rails generator migration up/down. The isolated core uses JSON 2.7.1.
225
+ The root and activated-core audit reports no findings against the recorded
226
+ advisory database. These are development artifact checks, not public downloads.
227
+
228
+ ### Recorded Live Provider Session
229
+
230
+ The 2026-10-21 local session uses OpenRouter with `openai/gpt-4.1-mini`,
231
+ RubyLLM 2.1.1, and Ruby 3.3.5. Both live examples pass: streamed text, then a
232
+ synthetic tool approval/resume with its original call id, redaction, and completed
233
+ resume reconnect. The tool is not executed before approval and executes once
234
+ after it. The same command includes one offline harness example, for three
235
+ examples total with zero failures. It verifies the gem's Ruby path, not a live
236
+ provider session through the browser or a deployed Rails application.
237
+
238
+ This session first exposed duplicate tool-call starts on a real resume.
239
+ An intercepted-HTTP real-chat test reproduces that defect before the fix and
240
+ passes afterward. Text, tool results, and approval are live evidence for this
241
+ route and model only. Live cancellation, timeout timing, network loss, denial,
242
+ and other providers remain unverified. Follow
243
+ [Provider Verification]({% link _advanced/provider-verification.md %}) to reproduce.
244
+
245
+ The checked current `ag-ui-protocol` remains 0.2.0. Its missing cancelled
246
+ outcome and `RUN_STARTED.protocolVersion` still require the local protocol
247
+ shims. Their encoded events pass the pinned schema checks; no workaround is
248
+ removed solely because a new version was expected.
249
+
57
250
  ## Local 0.3 Development Verification
58
251
 
59
252
  On 2026-10-19, Ruby 3.3.5, RubyLLM 2.1.1, and Rails 8.1.4 pass 284 examples
@@ -89,6 +282,14 @@ chat. Version 0.3 bounds JSON to 2.x; the passing matrix uses 2.21.2. Intercepte
89
282
  HTTP tests reproduce the failure before the bound and pass after it. These
90
283
  checks make no live provider call.
91
284
 
285
+ The [0.3.0 release workflow](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39376258843)
286
+ passes offline tests, browser workflows, advisory checks, and installed-host
287
+ plus clean core/Rails checks. After publication, the actual GitHub and RubyGems
288
+ downloads have matching SHA-256 hashes and all 62 packaged files match the tag.
289
+ The downloaded artifact independently passes both installed endpoints and fresh
290
+ core, advisory, and Rails generator migration checks. The isolated macOS core
291
+ activates JSON 2.7.1; the remote test matrix uses 2.21.2.
292
+
92
293
  ## Recorded 0.2 Client Verification
93
294
 
94
295
  On 2026-10-19, the local 0.2.0 candidate passes the maintained browser workflows
@@ -126,12 +327,14 @@ checks after download.
126
327
  - **Other clients or versions.** CopilotKit and client versions other than the
127
328
  recorded `@ag-ui/client` version have not been verified. Schema conformance
128
329
  does not establish that every UI renders the events correctly.
129
- - **Live providers.** `spec/live/live_run_spec.rb` is the opt-in check
130
- (`RUBY_LLM_LIVE=1`, plus a provider key); its provider context is skipped in the default suite. The same run setup
131
- is exercised separately with an offline chat. Provider behavior in 2.1.1 is derived from its source, not from a recorded
132
- session.
330
+ - **Other live paths.** Only the recorded OpenRouter model's text and approval
331
+ workflow is verified live. Anthropic, Gemini, and OpenAI Responses streams are
332
+ checked with intercepted HTTP only. Browser provider sessions, other
333
+ providers, cancellation timing, timeouts, and network-loss recovery need
334
+ separate evidence.
133
335
  - **Every RubyLLM patch release in the `>= 2.1, < 3.0` range.** The upper bound
134
- is enforced by the gemspec; the verified version is 2.1.1.
336
+ is a dependency resolver bound; verified versions are 2.1.0 and 2.1.1. Future
337
+ 2.x releases need the same checks before a compatibility claim.
135
338
  - **Rails versions before 8.0.** The adapter uses `Rails.setup!` and an
136
339
  initializer, and its specs run on 8.0/8.1. It may work on 7.2 and it is not
137
340
  tested there.
@@ -61,7 +61,7 @@ Legend:
61
61
  | `TEXT_MESSAGE_CONTENT` | text | One delta per non-empty `chunk.content`, in order. |
62
62
  | `TEXT_MESSAGE_END` | text | Closed before a tool call, a phase change or the terminal event. |
63
63
  | `TOOL_CALL_START` | tool | Emitted when a call is observed before it runs. |
64
- | `TOOL_CALL_ARGS` | tool | Arguments as received; never re-synthesized. |
64
+ | `TOOL_CALL_ARGS` | tool | Deltas that concatenate to the call's JSON arguments; streamed fragments unchanged. |
65
65
  | `TOOL_CALL_END` | tool | Closed before the call runs or the run ends. |
66
66
  | `TOOL_CALL_RESULT` | tool | The tool result, after the host redaction policy. |
67
67
  | `STATE_SNAPSHOT` | state | On a reconnect: the state the host gave the run. |
@@ -0,0 +1,103 @@
1
+ ---
2
+ layout: default
3
+ title: Public API Contract
4
+ nav_order: 3
5
+ description: Build against the application API and custom-store contract that 1.0 stabilizes.
6
+ ---
7
+
8
+ # {{ page.title }}
9
+
10
+ {{ page.description }}
11
+ {: .fs-6 .fw-300 }
12
+
13
+ After reading this guide, you will know:
14
+
15
+ * Which entry points applications can depend on.
16
+ * Which values and failures cross the integration boundary.
17
+ * How to implement a custom store without depending on orchestration internals.
18
+
19
+ ## Run One Authorized Turn
20
+
21
+ ```ruby
22
+ input = RubyLLM::AgUI::Input.parse(request_body)
23
+ record = RubyLLM::AgUI::Run.new(
24
+ chat: host_chat, input: input, scope: authenticated_scope, store: run_store
25
+ ).stream(to: response_stream)
26
+ record.status
27
+ ```
28
+
29
+ The host owns its chat, authentication, authorization, history, model, and tools.
30
+ Parsing client data never adds messages or tools to that chat. A completed run
31
+ returns its stored outcome on an exact retry; it never repeats the turn.
32
+ An active duplicate is refused. See
33
+ [Reconnects]({% link _core_features/reconnects.md %}).
34
+
35
+ Version 1.0.0 makes the following application contract a stability promise.
36
+ It follows Semantic Versioning: a change that breaks it waits for 2.0 and ships
37
+ with upgrade steps.
38
+
39
+ | Entry point | Application contract |
40
+ | --- | --- |
41
+ | `RubyLLM::AgUI.configure`, `.config`, `.reset_configuration!` | Application defaults listed in [Configuration]({% link _getting_started/configuration.md %}). |
42
+ | `Input.parse(raw, max_bytes: nil, strict: false, logger: nil)` | Accept a Hash, JSON String, or readable body; return parsed identity, data, digest, warnings, and `to_h`. |
43
+ | `Run.new(...).stream(to:)` | Reserve before execution; return a `RunRecord`; serialize callbacks and detach a failed transport. `Run#record` exposes the reserved record and, after completion or reconnect, the returned outcome. |
44
+ | `SSEWriter#write`, `#flush`, `#close`, `#closed?`, `.headers` | Encode schema-valid events on an IO-like stream; direct write failures raise `TransportError`. |
45
+ | `RunRecord`, `Interrupt`, `ResumeEntry` | Read-only identity and JSON data, predicates, documented transitions, and serialization. Transitions return new values. |
46
+ | `Redaction.default`, `.none` and a host callable | Transform tool output and opt-in progress; nil uses the default redactor. |
47
+ | `Coverage` | Inspect produced and unsupported event types for the pinned schema. |
48
+
49
+ `Mapper` is an advanced event projection API. Its documented methods accept
50
+ RubyLLM chunks, messages, and tool calls; they return events and do not persist
51
+ or execute work. Prefer `Run` when you need identity and terminal guarantees.
52
+ The protocol shim's concrete model classes and constructors are implementation
53
+ details. Depend on encoded AG-UI events, not on a shim class name.
54
+
55
+ ## Implement a Store
56
+
57
+ Implement the public methods on `Store::Base`: `reserve`, `find`, `latest_run`,
58
+ `latest_interrupted`, `save`, `find_interrupt`, and `redeem_interrupt`.
59
+ `recover` is supplied by the base class, or you can implement the same conditional
60
+ contract. Return `Reservation` and `Redemption` values where the interface
61
+ requires them. Their constructors and predicates are extension API.
62
+
63
+ Keep scope and run identity isolated. Reserve identities and redeem approvals
64
+ atomically. `save(record)` compares the observed revision and returns a new
65
+ record with a higher revision. Retain the return value. A stale write raises
66
+ `StaleRecordError`. A recovery never supersedes a terminal or newer outcome.
67
+ Read [Worker Recovery]({% link _advanced/worker-recovery.md %}) before using it.
68
+
69
+ Use `MemoryStore` within one process, or `Rails::ActiveRecordStore` with the
70
+ shipped migration. The verified database is SQLite. Other databases require
71
+ independent concurrency evidence.
72
+
73
+ ## Handle Errors at the Right Boundary
74
+
75
+ `InputError#http_status` is 400 for malformed or invalid input, 413 for size
76
+ limits, and 409 for identity conflicts or rejected resumes. `ConfigurationError`
77
+ is a host setup error. An active duplicate raises `StreamError`; the Rails
78
+ adapter refuses it before committing the stream with 409.
79
+
80
+ A provider or tool failure becomes a sanitized `RUN_ERROR` and failed record.
81
+ A cooperative cancellation becomes a cancelled outcome. A `PersistenceError`
82
+ propagates because acknowledgement may be uncertain. Inspect storage before
83
+ recovery; do not infer whether an external tool effect happened from that error.
84
+ A `RunConflictError`, including `StaleRecordError`, also propagates.
85
+
86
+ The Rails entry point is `stream_ag_ui_run { |input| authorized_chat }`.
87
+ Override `ag_ui_scope` and optionally `ag_ui_state`. Configure storage with
88
+ `config.run_store`. Private concern helpers are not extension API. Follow the
89
+ [Rails guide]({% link _advanced/rails-integration.md %}) for their signatures.
90
+
91
+ ## Avoid Orchestration Internals
92
+
93
+ `Emitter`, `Resume`, `Reconnect`, `MessageParser`, input parser helpers,
94
+ `Validation`, `ErrorSanitizer`, `Persistence`, and `Immutable` are internal.
95
+ Their names, constructors, and methods can change without an application API
96
+ migration. Store private helpers and generated Rails model internals have the
97
+ same boundary.
98
+
99
+ ## Next Steps
100
+
101
+ * [API Reference]({% link _reference/api-reference.md %}) - inspect source signatures.
102
+ * [Compatibility]({% link _reference/compatibility.md %}) - read tested versions and limits.
103
+ * [Upgrading]({% link _reference/upgrading.md %}) - adapt older applications.
@@ -17,7 +17,9 @@ description: Review RubyLLM AG-UI releases, newest first, with highlights and up
17
17
 
18
18
  | Release | Date | Highlights |
19
19
  | --- | --- | --- |
20
- | [0.3.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.3.0) | 2026-10-20 | [Lifecycle and worker recovery]({% link _getting_started/whats-new-in-0-3.md %}): disconnect handling, scoped cancellation, and conditional durable writes |
20
+ | [1.0.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v1.0.0) | 2026-11-02 | [Stable integration contract]({% link _getting_started/whats-new-in-1-0.md %}): streamed tool calls fixed across provider protocols, Ruby 3.3 or newer, and a rehearsed upgrade from 0.4 |
21
+ | [0.4.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.4.0) | 2026-10-21 | [API and compatibility]({% link _reference/whats-new-in-0-4.md %}): effective configuration, immutable records, and real-chat approval verification |
22
+ | [0.3.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.3.0) | 2026-10-20 | [Lifecycle and worker recovery]({% link _reference/whats-new-in-0-3.md %}): disconnect handling, scoped cancellation, and conditional durable writes |
21
23
  | [0.2.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.2.0) | 2026-10-19 | [Client workflows and tool progress]({% link _reference/whats-new-in-0-2.md %}): opt-in redacted progress, a real-client demo, and completed resume reconnect |
22
24
  | [0.1.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.1.0) | 2026-10-18 | [First release]({% link _reference/whats-new-in-0-1.md %}): AG-UI event mapping, approval and resume, cancellation, reconnect, and the optional Rails adapter |
23
25
 
@@ -40,6 +40,11 @@ so local and CI builds use the same navigation and parser.
40
40
 
41
41
  ## Review Release Scope
42
42
 
43
+ Keep `released: false` on `main` between releases. For a release that changes
44
+ the public contract or its upgrade path, build the artifact, run
45
+ `bundle exec ruby bin/verify-upgrade` with the previous published gem, and
46
+ install it in a real application before you tag.
47
+
43
48
  Use the repository's [roadmap](https://github.com/yorzi/ruby_llm-ag-ui/blob/main/ROADMAP.md)
44
49
  for proposed iterations and the 1.0 release conditions. Guides describe available
45
50
  behavior; the roadmap describes planned work. Check the release's conditions
@@ -15,42 +15,61 @@ After reading this guide, you will know:
15
15
  * How to move between versioned releases.
16
16
  * Where to find changes that need code updates.
17
17
 
18
- ## Move from 0.2 to 0.3
18
+ ## Move from 0.4 to 1.0
19
19
 
20
- Drain your old workers, change your Gemfile, and update the dependency:
20
+ Update your Gemfile and dependency:
21
21
 
22
22
  ```ruby
23
- gem 'ruby_llm-ag_ui', '~> 0.3.0'
23
+ gem 'ruby_llm-ag_ui', '~> 1.0'
24
24
  ```
25
25
 
26
26
  ```sh
27
27
  bundle update ruby_llm-ag_ui
28
28
  ```
29
29
 
30
- Version 0.3 requires JSON 2.x. Rails 8.0 passes an option removed in JSON 3
31
- when RubyLLM loads its chat class. If your Gemfile pins JSON 3, remove that pin
32
- or select JSON 2.x before updating. This bound also applies to plain Ruby hosts.
33
-
34
- `Run` now continues after a response write or flush fails. It saves the real
35
- outcome instead of reporting the disconnected client as a failed run. Hosts
36
- that previously relied on disconnects to stop work must explicitly request
37
- cancellation on the authorized chat. `SSEWriter` still raises a `StreamError`
38
- subclass when used directly. See
39
- [Streaming Runs]({% link _core_features/streaming-runs.md %}).
40
-
41
- Store writes now use an atomic revision check. Always retain the record returned
42
- by `save`. Custom stores must implement this contract before upgrading. Existing
43
- JSON payloads load with revision zero and the shipped table needs no migration.
44
- Drain old workers first, since 0.2 writers do not enforce revision checks.
45
- `PersistenceError` now propagates storage failures without guessing a terminal
46
- outcome. Read [Worker Recovery]({% link _advanced/worker-recovery.md %}) for
47
- explicit recovery and external-effect reconciliation.
48
-
49
- Faraday request timeouts now use `transport_timeout` instead of the generic
50
- `transport_error` code. Both remain failed outcomes. See
51
- [Cancellation and Timeouts]({% link _core_features/cancellation.md %}).
30
+ 1.0 keeps the 0.4 public API, configuration, and store
31
+ contract. It needs no SQL migration, and the generated migration and
32
+ initializer are unchanged. Records written by 0.4 stay readable: an exact retry
33
+ reconnects to a 0.4 run, and a 0.4 interrupt can be resumed after the upgrade.
34
+
35
+ Clients now receive tool argument deltas that join to valid JSON for every
36
+ streamed call. If your client worked around the old `{}` prefix or Ruby
37
+ `Hash#to_s` arguments, remove that workaround.
38
+
39
+ Requiring the gem no longer loads `ActiveRecord::Base` during a Rails boot.
40
+ Code that relied on the gem to load Active Record must load it itself.
41
+
42
+ 1.0 requires Ruby 3.3 or newer. Upgrade an application on Ruby 3.2 before you
43
+ update the gem; Bundler refuses to install 1.0 on Ruby 3.2.
44
+
45
+ ## Move from 0.3 to 0.4
46
+
47
+ Update your Gemfile and dependency:
48
+
49
+ ```ruby
50
+ gem 'ruby_llm-ag_ui', '~> 0.4.0'
51
+ ```
52
+
53
+ ```sh
54
+ bundle update ruby_llm-ag_ui
55
+ ```
56
+
57
+ This release keeps JSON 2.x and the 0.3 store revision contract. It needs no
58
+ additional SQL migration. Drain old workers before replacing their code.
59
+
60
+ Remove assignments to `config.allow_client_history`. The unused setting is
61
+ removed, including its diagnostic key. The gem never imports client messages
62
+ into the host chat; reconcile history in your host application.
63
+
64
+ `config.protocol_version` remains `"1.0"`. Assigning any other value now raises
65
+ `ConfigurationError` instead of accepting a setting the emitted events ignore.
66
+
67
+ Nested request and JSON record values are now read-only. In-place edits raise
68
+ `FrozenError`. Build a new input, or use record transitions and `store.save`,
69
+ instead of mutating ids, snapshots, failure hashes, or interrupt values.
70
+ Caller-owned JSON objects remain mutable and do not alias the stored record.
52
71
 
53
72
  ## Older Releases
54
73
 
55
- For earlier upgrade steps, read the
56
- [0.2 upgrading guide](https://github.com/yorzi/ruby_llm-ag-ui/blob/v0.2.0/docs/_reference/upgrading.md).
74
+ Read the [0.3 upgrading guide](https://github.com/yorzi/ruby_llm-ag-ui/blob/v0.3.0/docs/_reference/upgrading.md)
75
+ for JSON 2.x, worker draining, and the custom-store revision contract.
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  layout: default
3
3
  title: "What's New in 0.3"
4
- nav_order: -1
4
+ nav_order: 30
5
+ parent: Release History
5
6
  description: Verify transport failure, scoped cancellation, and explicit worker recovery.
6
7
  ---
7
8
 
@@ -0,0 +1,58 @@
1
+ ---
2
+ layout: default
3
+ title: "What's New in 0.4"
4
+ nav_order: 40
5
+ parent: Release History
6
+ description: Review the public integration contract and verified compatibility boundaries.
7
+ ---
8
+
9
+ # {{ page.title }}
10
+
11
+ {{ page.description }}
12
+ {: .fs-6 .fw-300 }
13
+
14
+ After reading this guide, you will know:
15
+
16
+ * Which configuration changes need an application update.
17
+ * Where to find the proposed public API and compatibility evidence.
18
+
19
+ ## Use Effective Configuration
20
+
21
+ ```ruby
22
+ RubyLLM::AgUI.configure do |config|
23
+ config.protocol_version = '1.0'
24
+ end
25
+ ```
26
+
27
+ Other protocol versions raise `ConfigurationError`. The unused
28
+ `allow_client_history` setting is removed. Client history remains the host's
29
+ responsibility. See [Upgrading]({% link _reference/upgrading.md %}).
30
+
31
+ ## Preserve Immutable Request and Store Values
32
+
33
+ Parsed input and JSON record values now copy and freeze their nested members.
34
+ Changing a caller's original state cannot change a stored snapshot or identity.
35
+ Use new inputs and record transitions instead of editing nested values. See
36
+ [Reconnects]({% link _core_features/reconnects.md %}).
37
+
38
+ The [Public API Contract]({% link _reference/public-api.md %}) identifies
39
+ application and custom-store APIs and separates orchestration internals.
40
+
41
+ ## Associate Resumed Tool Results Once
42
+
43
+ Real RubyLLM approval resumes now emit the result of the original call without
44
+ repeating its start and arguments. The offline real-chat and opt-in provider
45
+ checks use the same harness. `Run#record` also exposes the recorded outcome
46
+ after a reconnect, matching the return value from `stream`. See
47
+ [Approval and Resume]({% link _core_features/approval-and-resume.md %}).
48
+
49
+ ## Verify the Provider Separately
50
+
51
+ The opt-in harness checks OpenRouter text and a synthetic approval/resume
52
+ without external business effects. The same real RubyLLM chat setup has offline
53
+ HTTP tests. See [Provider Verification]({% link _advanced/provider-verification.md %})
54
+ for credential handling, request limits, and the scope of the results.
55
+
56
+ Read
57
+ [Compatibility]({% link _reference/compatibility.md %}) for recorded results
58
+ and limits; an intended matrix is not a completed verification.
@@ -10,8 +10,8 @@ module RubyLLM
10
10
  # config.logger = Rails.logger
11
11
  # end
12
12
  #
13
- # Every value can be overridden per run by passing the matching keyword to
14
- # RubyLLM::AgUI::Run.new.
13
+ # Run.new can override storage, logging, redaction, clock, interrupt expiry,
14
+ # and tool progress. Input.parse uses the configured request limits.
15
15
  class Configuration
16
16
  # The object that reserves run identity and stores interrupts. Defaults
17
17
  # to nil; set a RubyLLM::AgUI::Store::MemoryStore for single-process use,
@@ -38,7 +38,17 @@ module RubyLLM
38
38
 
39
39
  # The AG-UI protocol version this producer speaks, emitted on
40
40
  # RUN_STARTED so a consumer can detect a downgrade.
41
- attr_accessor :protocol_version
41
+ attr_reader :protocol_version
42
+
43
+ # Accepts only the protocol implemented by this producer. A different
44
+ # version is refused instead of silently reporting a misleading setting.
45
+ def protocol_version=(value)
46
+ unless value == Protocol::PROTOCOL_VERSION
47
+ raise ConfigurationError, "This producer supports protocol #{Protocol::PROTOCOL_VERSION} only."
48
+ end
49
+
50
+ @protocol_version = value
51
+ end
42
52
 
43
53
  # Maximum accepted request body size in bytes.
44
54
  attr_accessor :max_input_bytes
@@ -58,23 +68,17 @@ module RubyLLM
58
68
  # A callable returning the current UTC Time. Injected in tests.
59
69
  attr_accessor :clock
60
70
 
61
- # Whether client-supplied message history is reconciled against
62
- # host-stored history. Always off in the first release: client messages
63
- # are never trusted as system or tool turns.
64
- attr_accessor :allow_client_history
65
-
66
71
  def initialize
67
72
  @run_store = nil
68
73
  @redact = Redaction.method(:default)
69
74
  @logger = nil
70
- @protocol_version = '1.0'
75
+ @protocol_version = Protocol::PROTOCOL_VERSION
71
76
  @max_input_bytes = 256_000
72
77
  @max_messages = 500
73
78
  @max_tools = 64
74
79
  @max_context = 64
75
80
  @interrupt_ttl = 900
76
81
  @clock = -> { Time.now.utc }
77
- @allow_client_history = false
78
82
  @emit_tool_progress = false
79
83
  end
80
84
 
@@ -92,7 +96,8 @@ module RubyLLM
92
96
  :custom
93
97
  end
94
98
 
95
- # The run store, or nil when the host has not configured one.
99
+ # The configured run store. Raises ConfigurationError when the host has
100
+ # not configured one.
96
101
  def run_store!
97
102
  @run_store || raise(ConfigurationError, 'No run_store is configured. ' \
98
103
  'Set RubyLLM::AgUI.config.run_store or pass store: to Run.new.')
@@ -110,7 +115,6 @@ module RubyLLM
110
115
  max_tools: max_tools,
111
116
  max_context: max_context,
112
117
  interrupt_ttl: interrupt_ttl,
113
- allow_client_history: allow_client_history,
114
118
  emit_tool_progress: emit_tool_progress
115
119
  }
116
120
  end
@@ -14,7 +14,7 @@ module RubyLLM
14
14
  # The emitter decides nothing about the outcome and executes nothing. What it
15
15
  # owns is the one ordering rule a caller should never have to remember: a
16
16
  # run's open text, tool calls and step are closed before the terminal event.
17
- class Emitter
17
+ class Emitter # :nodoc:
18
18
  # The run record, including the sequence numbers written so far.
19
19
  attr_reader :record
20
20
 
@@ -9,7 +9,7 @@ module RubyLLM
9
9
  # module never does that: it classifies the error by class and returns a
10
10
  # fixed, public message. The raw exception goes to the host logger, if the
11
11
  # host configured one, and nowhere else.
12
- module ErrorSanitizer
12
+ module ErrorSanitizer # :nodoc:
13
13
  # Ordered by specificity. The first ancestor of the error whose name is a
14
14
  # key wins, so subclass relationships are respected without loading
15
15
  # optional error classes eagerly.