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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +70 -0
- data/CONTRIBUTING.md +4 -0
- data/README.md +2 -2
- data/docs/_advanced/client-example.md +7 -0
- data/docs/_advanced/provider-verification.md +70 -0
- data/docs/_advanced/rails-integration.md +9 -1
- data/docs/_advanced/security-and-deployment.md +2 -2
- data/docs/_core_features/approval-and-resume.md +9 -0
- data/docs/_core_features/reconnects.md +15 -0
- data/docs/_core_features/streaming-runs.md +9 -1
- data/docs/_getting_started/configuration.md +7 -2
- data/docs/_getting_started/getting-started.md +1 -1
- data/docs/_getting_started/overview.md +2 -1
- data/docs/_getting_started/whats-new-in-1-0.md +103 -0
- data/docs/_reference/api-reference.md +2 -1
- data/docs/_reference/compatibility.md +211 -8
- data/docs/_reference/protocol-coverage.md +1 -1
- data/docs/_reference/public-api.md +103 -0
- data/docs/_reference/release-history.md +3 -1
- data/docs/_reference/releasing.md +5 -0
- data/docs/_reference/upgrading.md +46 -27
- data/docs/{_getting_started → _reference}/whats-new-in-0-3.md +2 -1
- data/docs/_reference/whats-new-in-0-4.md +58 -0
- data/lib/ruby_llm/ag_ui/configuration.rb +16 -12
- data/lib/ruby_llm/ag_ui/emitter.rb +1 -1
- data/lib/ruby_llm/ag_ui/error_sanitizer.rb +1 -1
- data/lib/ruby_llm/ag_ui/immutable.rb +34 -0
- data/lib/ruby_llm/ag_ui/input.rb +12 -6
- data/lib/ruby_llm/ag_ui/interrupt.rb +10 -10
- data/lib/ruby_llm/ag_ui/mapper.rb +60 -15
- data/lib/ruby_llm/ag_ui/message_parser.rb +1 -1
- data/lib/ruby_llm/ag_ui/rails/active_record_store.rb +18 -9
- data/lib/ruby_llm/ag_ui/rails/streaming.rb +8 -2
- data/lib/ruby_llm/ag_ui/reconnect.rb +1 -1
- data/lib/ruby_llm/ag_ui/redaction.rb +3 -1
- data/lib/ruby_llm/ag_ui/resume.rb +1 -1
- data/lib/ruby_llm/ag_ui/resume_entry.rb +3 -3
- data/lib/ruby_llm/ag_ui/run.rb +18 -13
- data/lib/ruby_llm/ag_ui/run_record.rb +10 -10
- data/lib/ruby_llm/ag_ui/sse_writer.rb +20 -3
- data/lib/ruby_llm/ag_ui/store/memory_store.rb +3 -3
- data/lib/ruby_llm/ag_ui/validation.rb +1 -1
- data/lib/ruby_llm/ag_ui/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: faaf47d4aefadd16b5b9f9ee3a069efca39ada7c5e6935306879d82fcbe6094f
|
|
4
|
+
data.tar.gz: 2d81db9c7f7429a33391eb485d791160b5cf363b3313a0c3e65807a72b85fb16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ae655ed6335e4ca391c2caf310567d0ca471d4d2cc7594cae3c0d631456d28627bf3ac2828f895f59e742bc9ea2e9cd94c7e8ea6549fb4db724cadb1506e05f
|
|
7
|
+
data.tar.gz: 15b3541966a7a4fc2baa342525da774e1adff49929c4d5e334ea8c420ae14a75a5c62bcb574f28a0b69b282865e355c5395391d3cd193ca160dc4a93fe095d26
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,76 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.0.0] - 2026-11-02
|
|
10
|
+
|
|
11
|
+
The stable integration contract. The public API, configuration, and store
|
|
12
|
+
contract proposed in 0.4 are now covered by Semantic Versioning.
|
|
13
|
+
|
|
14
|
+
### Removed
|
|
15
|
+
|
|
16
|
+
- Support for Ruby 3.2, which reached end of life in March 2026. The gem now
|
|
17
|
+
requires Ruby 3.3 or newer, and CI tests Ruby 3.3, 3.4, and 4.0.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The durable store finds interrupted runs through the shipped status index,
|
|
22
|
+
instead of loading and parsing every run on the thread for each resume.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Open a new tool call when a streamed fragment carries a new id under a stream
|
|
27
|
+
index already in use, as RubyLLM does. An OpenAI-compatible server that sends
|
|
28
|
+
each parallel call whole at index 0 no longer has a second call's arguments
|
|
29
|
+
appended to the first call.
|
|
30
|
+
- Handle stream refusals in Rails hosts without Active Record, preserving
|
|
31
|
+
unrelated host errors instead of replacing them with a missing constant.
|
|
32
|
+
- Honor zero quality and media-range precedence in `SSEWriter.accepts?`.
|
|
33
|
+
Rails refuses an unacceptable stream with 406 before resolving a chat or
|
|
34
|
+
reserving a run, even when a wildcard would otherwise allow streaming.
|
|
35
|
+
- Open each streamed tool call of a later tool round in the same turn. Providers
|
|
36
|
+
restart stream indexes in every response, so a second round's arguments were
|
|
37
|
+
sent to the first round's ended call before the new call opened.
|
|
38
|
+
- Send streamed tool arguments that concatenate to valid JSON for Anthropic,
|
|
39
|
+
Bedrock, and Gemini. The empty input object that opens an Anthropic or
|
|
40
|
+
Bedrock call is no longer sent before its partial JSON, and a whole Gemini
|
|
41
|
+
call is serialized as JSON instead of Ruby `Hash#to_s` output.
|
|
42
|
+
- Defer loading `ActiveRecord::Base` until the host uses the durable store.
|
|
43
|
+
Requiring the gem during a Rails boot no longer loads Active Record before
|
|
44
|
+
the application's configuration.
|
|
45
|
+
- Accept a redaction policy object that defines only `#call`, instead of
|
|
46
|
+
failing the run when a tool result or progress update is redacted.
|
|
47
|
+
- Refuse input with text that is not UTF-8, or a number JSON cannot represent,
|
|
48
|
+
as `MalformedInputError` (400) instead of raising `JSON::GeneratorError`.
|
|
49
|
+
- Release a finished run's response stream. RubyLLM cannot remove callbacks,
|
|
50
|
+
so a chat reused across turns kept every earlier run's stream reachable.
|
|
51
|
+
|
|
52
|
+
## [0.4.0] - 2026-10-21
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- A proposed public application and custom-store contract, with orchestration
|
|
57
|
+
internals excluded from generated API documentation.
|
|
58
|
+
- Explicit RubyLLM 2.1.0 and 2.1.1 CI matrices, and a shared intercepted/live
|
|
59
|
+
OpenRouter harness for text, approval, result association, and reconnect.
|
|
60
|
+
- Client-state assertions for one original tool call and one associated result.
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
|
|
64
|
+
- Remove the unused `allow_client_history` configuration and diagnostic key.
|
|
65
|
+
Client messages remain untrusted data under host-controlled history policy.
|
|
66
|
+
- Reject unsupported `protocol_version` configuration instead of accepting a
|
|
67
|
+
setting that cannot change the producer's fixed 1.0 output.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- Expose the returned reconnect outcome through `Run#record`, without executing
|
|
72
|
+
the chat again. Verify real RubyLLM denial and installed result association.
|
|
73
|
+
- Resume real RubyLLM approval without repeating the original tool-call start
|
|
74
|
+
and arguments. Its result keeps the original call id; new calls still stream.
|
|
75
|
+
- Isolate and freeze nested input, identity, interrupt, and JSON record values.
|
|
76
|
+
Editing caller-owned data cannot mutate memory-store indexes or bypass a
|
|
77
|
+
record revision; editing published values raises `FrozenError`.
|
|
78
|
+
|
|
9
79
|
## [0.3.0] - 2026-10-20
|
|
10
80
|
|
|
11
81
|
### Added
|
data/CONTRIBUTING.md
CHANGED
|
@@ -41,6 +41,10 @@ The package probe installs the artifact outside the checkout using available
|
|
|
41
41
|
development dependencies; `bin/verify-package` separately tests clean dependency
|
|
42
42
|
resolution. Shut down all task-owned processes when the check finishes.
|
|
43
43
|
|
|
44
|
+
Before a release, build the gem and run `bundle exec ruby bin/verify-upgrade`
|
|
45
|
+
with the downloaded previous release's gem path. It checks installed artifacts in
|
|
46
|
+
separate processes against one temporary SQLite database, without a provider.
|
|
47
|
+
|
|
44
48
|
Every behavior change needs a test, and lifecycle, identity and security changes
|
|
45
49
|
need their negative case too. The acceptance IDs (FR-01..FR-08) are referenced
|
|
46
50
|
in spec descriptions. Offline CI uses fakes; live provider tests are opt-in and
|
data/README.md
CHANGED
|
@@ -19,10 +19,10 @@ RubyLLM and AG-UI maintainers.
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
|
-
gem 'ruby_llm-ag_ui', '~>
|
|
22
|
+
gem 'ruby_llm-ag_ui', '~> 1.0'
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Requires Ruby >= 3.
|
|
25
|
+
Requires Ruby >= 3.3, RubyLLM >= 2.1 and < 3.0, and `ag-ui-protocol` 0.2.x.
|
|
26
26
|
Run `bundle install` after adding the gem.
|
|
27
27
|
|
|
28
28
|
## Stream a run
|
|
@@ -37,6 +37,13 @@ Choose **Plain Ruby** or **Rails + SQLite**, then run a turn. The official
|
|
|
37
37
|
chat per fixture actor and thread, so approval resumes the original tool call
|
|
38
38
|
and later turns use the same conversation.
|
|
39
39
|
|
|
40
|
+
The development bundle pins `@ag-ui/client` 1.0.3 and overrides Zod to 4.6.6
|
|
41
|
+
for [GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5).
|
|
42
|
+
The client and core schema code import `zod/v4`; browser workflows verify the
|
|
43
|
+
override with the pinned client. Run `npm audit` alongside the browser checks.
|
|
44
|
+
These JavaScript packages are development dependencies and are not shipped in
|
|
45
|
+
the Ruby gem.
|
|
46
|
+
|
|
40
47
|
## Try the Interactions
|
|
41
48
|
|
|
42
49
|
The tool scenario pauses for approval. Approve it to run a synthetic order
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Provider Verification
|
|
4
|
+
nav_order: 6
|
|
5
|
+
description: Run opt-in provider checks separately from offline client and protocol tests.
|
|
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
|
+
* How to run the maintained live checks with synthetic input.
|
|
16
|
+
* What the checks verify and which calls can reach a provider.
|
|
17
|
+
* How to keep credentials and provider results out of shared evidence.
|
|
18
|
+
|
|
19
|
+
## Run the Opt-in Checks
|
|
20
|
+
|
|
21
|
+
From the repository, with `OPENROUTER_API_KEY` already configured:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
RUBY_LLM_LIVE=1 bundle exec rspec spec/live
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The harness uses OpenRouter with `openai/gpt-4.1-mini`. Set
|
|
28
|
+
`RUBY_LLM_LIVE_MODEL` to choose another OpenRouter model; record its name and
|
|
29
|
+
result separately. A successful model does not verify every model on the gateway.
|
|
30
|
+
These calls can incur provider charges. Default offline tests never run them.
|
|
31
|
+
|
|
32
|
+
If you use an environment file, keep it untracked and load it through dotenv:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
RUBY_LLM_LIVE=1 bundle exec dotenv -f .env.live rspec spec/live
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Set the key in that file or your existing credential manager. Do not put keys
|
|
39
|
+
in command arguments, inline exports, screenshots, or committed fixtures.
|
|
40
|
+
The repository ignores `.env*` files except `.env.example`.
|
|
41
|
+
|
|
42
|
+
## Understand the Checks
|
|
43
|
+
|
|
44
|
+
One example streams a short text response. Another forces a synthetic lookup
|
|
45
|
+
that requires approval, verifies no tool execution before approval, resumes the
|
|
46
|
+
original call, and reconnects the completed resume. The tool only returns a
|
|
47
|
+
fixture value; it does not access a database, file, or business service.
|
|
48
|
+
Its result is redacted and retains the original tool-call id.
|
|
49
|
+
|
|
50
|
+
The provider configuration disables retries, caps output at 128 tokens, uses
|
|
51
|
+
a 30-second request timeout, and discards provider logs. The live network
|
|
52
|
+
allowlist permits only the OpenRouter HTTPS chat-completions endpoint. This
|
|
53
|
+
allowlist is a test guard, not an operating-system firewall.
|
|
54
|
+
|
|
55
|
+
An offline test drives the same setup through intercepted HTTP. It verifies
|
|
56
|
+
the bounded request and reproduces the real RubyLLM approval callbacks without
|
|
57
|
+
credentials. Browser tests continue to use the maintained synthetic host; they
|
|
58
|
+
verify the official client's message and tool-result association separately.
|
|
59
|
+
|
|
60
|
+
## Record Evidence Without Secrets
|
|
61
|
+
|
|
62
|
+
Record the date, Ruby and RubyLLM versions, provider route, model, pass/fail
|
|
63
|
+
result, and any fixed regression. Keep generated evidence under ignored `tmp/`.
|
|
64
|
+
Do not save raw HTTP headers or provider traces. A failed assertion, intercepted
|
|
65
|
+
request, or schema-valid event is not proof that a live request completed.
|
|
66
|
+
|
|
67
|
+
For the recorded results and unverified paths, read
|
|
68
|
+
[Compatibility]({% link _reference/compatibility.md %}). Live cancellation,
|
|
69
|
+
timeouts, and network-loss timing require separate provider evidence; offline
|
|
70
|
+
fault injection does not establish those provider behaviors.
|
|
@@ -85,7 +85,7 @@ app knows what the client is looking at.
|
|
|
85
85
|
| Request | Response |
|
|
86
86
|
|---|---|
|
|
87
87
|
| Valid input, `Accept: text/event-stream` | `200`, SSE, one `data:` line per AG-UI event |
|
|
88
|
-
| `Accept` that cannot read SSE | `406` before
|
|
88
|
+
| `Accept` that cannot read SSE, including an effective `q=0` | `406` before resolving the chat or reserving a run |
|
|
89
89
|
| Empty, non-JSON, or schema-invalid body | `400` |
|
|
90
90
|
| Body past `config.max_input_bytes` | `413` |
|
|
91
91
|
| `threadId` the actor does not own, when the block raises `ActiveRecord::RecordNotFound` | `404` |
|
|
@@ -195,6 +195,14 @@ what `spec/support/fake_chat.rb` in this repository does.
|
|
|
195
195
|
| Tool results are `[redacted]` | Redaction is the default; configure `config.redact` |
|
|
196
196
|
| A run succeeds but the client shows nothing | The client was not sent the interrupt/resume flow it expected, or it re-sent a `runId` whose run had already ended |
|
|
197
197
|
|
|
198
|
+
## Use Rails Without Active Record
|
|
199
|
+
|
|
200
|
+
You can use the streaming concern without Active Record. In that setup,
|
|
201
|
+
configure a host-supplied store and resolve the chat from your own persistence.
|
|
202
|
+
Stream conflicts still return 409. When Active Record is loaded, a missing
|
|
203
|
+
record returns 404. Other errors raised while resolving a chat remain host
|
|
204
|
+
errors and propagate to your application's error handling.
|
|
205
|
+
|
|
198
206
|
## Next Steps
|
|
199
207
|
|
|
200
208
|
* [Approval and Resume]({% link _core_features/approval-and-resume.md %}) - answer a tool approval pause.
|
|
@@ -43,8 +43,8 @@ responsibility.
|
|
|
43
43
|
- **Choose the model, tools or system prompt.** `input.tools` is informational:
|
|
44
44
|
`Input#tool_names` and `Input#client_tools?` report it, and nothing in the gem
|
|
45
45
|
registers a client-supplied tool on the chat. `input.messages` is parsed and
|
|
46
|
-
echoed, never appended to the chat as trusted turns
|
|
47
|
-
|
|
46
|
+
echoed, never appended to the chat as trusted turns. The host owns history
|
|
47
|
+
reconciliation; this gem has no switch that imports client history.
|
|
48
48
|
- **Reach another actor's run.** Every lookup is bounded by the scope the host
|
|
49
49
|
supplies. The same `(threadId, runId)` under a different scope is a different
|
|
50
50
|
run (`spec/ruby_llm/ag_ui/run_spec.rb`: "does not let one scope attach to
|
|
@@ -60,3 +60,12 @@ The interrupt must still be pending and unexpired. The tool call id and argument
|
|
|
60
60
|
* [Streaming Runs]({% link _core_features/streaming-runs.md %}) - follow the event and outcome sequence.
|
|
61
61
|
* [Reconnects and Run Identity]({% link _core_features/reconnects.md %}) - understand stored run identity.
|
|
62
62
|
* [Security and Deployment]({% link _advanced/security-and-deployment.md %}) - keep approval separate from authorization.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Keep the Original Tool Call
|
|
66
|
+
|
|
67
|
+
RubyLLM fires its before-tool callback when an approved call executes. The
|
|
68
|
+
resume run does not repeat the original `TOOL_CALL_START`, arguments, or end.
|
|
69
|
+
Its `TOOL_CALL_RESULT` uses the original `toolCallId`. A later new tool call
|
|
70
|
+
still emits its own start and arguments. Keep the client conversation across
|
|
71
|
+
both runs so the result can attach to the call shown before the interrupt.
|
|
@@ -52,3 +52,18 @@ stuck record; deleting its reservation can repeat unknown tool effects.
|
|
|
52
52
|
* [Configuration]({% link _getting_started/configuration.md %}) - set the default store.
|
|
53
53
|
* [Rails Integration]({% link _advanced/rails-integration.md %}) - install the durable ActiveRecord store.
|
|
54
54
|
* [Protocol Coverage]({% link _reference/protocol-coverage.md %}) - inspect reconnect events.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Keep Request and Record Values Read-only
|
|
58
|
+
|
|
59
|
+
Parsed input, run identity, and JSON snapshots are isolated from the objects
|
|
60
|
+
supplied by the caller. Nested strings, arrays, hashes, and parsed SDK message
|
|
61
|
+
models are frozen. Editing them raises `FrozenError`; it cannot change the
|
|
62
|
+
reserved digest or bypass a store revision check. Constructors copy JSON values
|
|
63
|
+
rather than freezing the host's original state. Keep snapshots JSON-compatible.
|
|
64
|
+
|
|
65
|
+
Create a new input with `Input.parse` for a new request. Use `RunRecord`
|
|
66
|
+
transitions and retain `store.save`'s returned record when updating storage.
|
|
67
|
+
|
|
68
|
+
After `Run#stream` returns a recorded outcome, `Run#record` exposes that same
|
|
69
|
+
record, including on a reconnect. Reading it never executes the chat.
|
|
@@ -30,7 +30,7 @@ In an application, parse the request first, then pass the host-selected chat, pa
|
|
|
30
30
|
|
|
31
31
|
The mapper turns RubyLLM callbacks into AG-UI events. The emitter assigns each event a sequence, persists run state, closes open text or tool events, and writes one JSON event per `data:` line through the SSE writer.
|
|
32
32
|
|
|
33
|
-
An assistant message opens on its first non-empty chunk and closes before a tool call, phase change, or terminal event. A tool call starts when its id and name are known
|
|
33
|
+
An assistant message opens on its first non-empty chunk and closes before a tool call, phase change, or terminal event. A tool call starts when its id and name are known and ends before the call runs. Its argument deltas concatenate to the JSON arguments the tool receives: streamed fragments go out unchanged, a call a provider sends whole is serialized once, and the empty object some providers open a call with is not sent. Calls from one response can be open at the same time, so assemble arguments by `toolCallId`. One run ends with one terminal result.
|
|
34
34
|
|
|
35
35
|
## Outcomes
|
|
36
36
|
|
|
@@ -55,6 +55,14 @@ failure cannot replace an outcome that is already persisted. `SSEWriter` used
|
|
|
55
55
|
directly raises `TransportError`, a subclass of `StreamError`; `Run` handles
|
|
56
56
|
that transport error. Mapping and persistence errors are separate failures.
|
|
57
57
|
|
|
58
|
+
## Check the Client's Accept Header
|
|
59
|
+
|
|
60
|
+
`SSEWriter.accepts?` checks whether an `Accept` header permits an event stream.
|
|
61
|
+
An explicit `text/event-stream;q=0` refuses streaming even with `*/*;q=1`.
|
|
62
|
+
A specific media range takes precedence over its wildcard, following
|
|
63
|
+
[HTTP quality and media-range rules](https://www.rfc-editor.org/rfc/rfc9110.html#section-12.5.1).
|
|
64
|
+
The Rails adapter answers 406 before choosing a chat or reserving a run.
|
|
65
|
+
|
|
58
66
|
## Next Steps
|
|
59
67
|
|
|
60
68
|
* [Validating Input]({% link _core_features/input-validation.md %}) - parse untrusted request data.
|
|
@@ -40,14 +40,19 @@ The global configuration supplies defaults. `Run.new` can override the store, lo
|
|
|
40
40
|
| `redact` | `Redaction.default` | Transform tool results before they reach the stream. |
|
|
41
41
|
| `emit_tool_progress` | `false` | Publish tool progress as redacted activity snapshots. |
|
|
42
42
|
| `logger` | `nil` | Receive host-side diagnostics without prompts or raw tool payloads. |
|
|
43
|
-
| `protocol_version` | `"1.0"` |
|
|
43
|
+
| `protocol_version` | `"1.0"` | Fixed supported version reported by `RUN_STARTED`; setting another value raises `ConfigurationError`. |
|
|
44
44
|
| `max_input_bytes` | `256_000` | Maximum request body size. |
|
|
45
45
|
| `max_messages` | `500` | Maximum messages in one request. |
|
|
46
46
|
| `max_tools` | `64` | Maximum tool definitions in one request. |
|
|
47
47
|
| `max_context` | `64` | Maximum context entries in one request. |
|
|
48
48
|
| `interrupt_ttl` | `900` seconds | How long an approval interrupt can be answered. |
|
|
49
49
|
| `clock` | `Time.now.utc` | Clock used to set interrupt expiry. |
|
|
50
|
-
|
|
50
|
+
|
|
51
|
+
`Configuration#protocol_version=` accepts only `"1.0"`. Its value describes the
|
|
52
|
+
producer; it does not select another event schema.
|
|
53
|
+
|
|
54
|
+
Client history stays under host control. There is no configuration switch that
|
|
55
|
+
trusts or imports it into a chat.
|
|
51
56
|
|
|
52
57
|
Provider keys and model selection are configured through RubyLLM and the host app. This gem does not read credentials when it loads.
|
|
53
58
|
|
|
@@ -22,7 +22,7 @@ After reading this guide, you will know:
|
|
|
22
22
|
{% if site.docs_unreleased %}bundle add ruby_llm-ag_ui --git https://github.com/yorzi/ruby_llm-ag-ui --branch main{% else %}bundle add ruby_llm-ag_ui --version {{ site.version }}{% endif %}
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
The gem requires Ruby 3.
|
|
25
|
+
The gem requires Ruby 3.3 or newer, RubyLLM 2.1 or newer, and `ag-ui-protocol` 0.2.x. The Rails adapter is optional. Provider credentials belong to your RubyLLM application; the parser example below needs none.
|
|
26
26
|
|
|
27
27
|
The runtime dependencies select patched `cgi`, `resolv`, `uri`, and `zlib` gems. An older Ruby installation's default library versions do not override those dependency requirements.
|
|
28
28
|
|
|
@@ -111,7 +111,8 @@ reason.
|
|
|
111
111
|
the events to write. The mapper is a state machine: a text message opens on
|
|
112
112
|
its first non-empty chunk and closes before a tool call, a phase change or the
|
|
113
113
|
terminal event; a tool call opens when its id and name are both known, streams
|
|
114
|
-
|
|
114
|
+
argument deltas that concatenate to its JSON arguments, and closes before it
|
|
115
|
+
runs; one step per phase
|
|
115
116
|
(`completion`, `tool`) so consecutive steps never overlap.
|
|
116
117
|
6. **Write.** The emitter writes the events as SSE, advancing the run record's
|
|
117
118
|
sequence by one per event.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: "What's New in 1.0"
|
|
4
|
+
nav_order: -1
|
|
5
|
+
description: Install the stable 1.0 release, with streamed tool calls fixed across provider protocols, Ruby 3.3 or newer, and a rehearsed upgrade from 0.4.
|
|
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
|
+
* What the 1.0 stability promise covers.
|
|
16
|
+
* Which streamed tool-call fixes reach your client.
|
|
17
|
+
* What changed for Rails boots, malformed input, and long-lived chats.
|
|
18
|
+
|
|
19
|
+
## Install 1.0
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem 'ruby_llm-ag_ui', '~> 1.0'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Version 1.0.0 keeps the public API, configuration, and store contract that 0.4
|
|
26
|
+
proposed, with no new migration. From 1.0 on, that contract follows Semantic
|
|
27
|
+
Versioning: a change that breaks it waits for 2.0. See the
|
|
28
|
+
[Public API Contract]({% link _reference/public-api.md %}) for what it covers.
|
|
29
|
+
Report a problem with the versions from `RubyLLM::AgUI.config.to_h`, as
|
|
30
|
+
[Compatibility]({% link _reference/compatibility.md %}) describes.
|
|
31
|
+
|
|
32
|
+
## Use Ruby 3.3 or Newer
|
|
33
|
+
|
|
34
|
+
Ruby 3.2 reached end of life in March 2026, and 1.0 requires Ruby 3.3 or newer.
|
|
35
|
+
CI tests Ruby 3.3, 3.4, and 4.0 with RubyLLM 2.1.0 and 2.1.1.
|
|
36
|
+
|
|
37
|
+
## Stream Tool Calls Correctly Across Protocols
|
|
38
|
+
|
|
39
|
+
A client assembles a tool call's arguments by joining its `TOOL_CALL_ARGS`
|
|
40
|
+
deltas. Before this release, four provider shapes produced arguments the client
|
|
41
|
+
could not parse or attribute:
|
|
42
|
+
|
|
43
|
+
* A second tool round in one turn sent its arguments to the first round's ended
|
|
44
|
+
call. Chat Completions, OpenAI Responses, and Anthropic restart stream indexes
|
|
45
|
+
in every response.
|
|
46
|
+
* Anthropic and Bedrock open a call with an empty input object before streaming
|
|
47
|
+
partial JSON, so the client received `{}{"query":"one"}`.
|
|
48
|
+
* Gemini sends a whole call as a parsed object, which went out as Ruby
|
|
49
|
+
`Hash#to_s` output instead of JSON.
|
|
50
|
+
* Some OpenAI-compatible servers send each parallel call whole at index 0. The
|
|
51
|
+
second call's arguments were appended to the first call. RubyLLM starts a new
|
|
52
|
+
call for each fragment with a new id, and so does the mapper now.
|
|
53
|
+
|
|
54
|
+
Each call now opens once, and its deltas join to the JSON arguments the tool
|
|
55
|
+
received. Intercepted-HTTP specs run a real RubyLLM chat for Chat Completions,
|
|
56
|
+
Responses, Anthropic, and Gemini. Bedrock uses the same empty-object rule
|
|
57
|
+
without its own HTTP spec. See [Streaming Runs]({% link _core_features/streaming-runs.md %}).
|
|
58
|
+
|
|
59
|
+
## Boot Rails Without Loading Active Record Early
|
|
60
|
+
|
|
61
|
+
Requiring the gem during `Bundler.require` no longer loads `ActiveRecord::Base`.
|
|
62
|
+
The durable store's row class loads on first use, after your application's
|
|
63
|
+
configuration. The generated initializer still assigns
|
|
64
|
+
`RubyLLM::AgUI::Rails::ActiveRecordStore.new` as before.
|
|
65
|
+
|
|
66
|
+
## Refuse an Unacceptable Stream Before Provider Work
|
|
67
|
+
|
|
68
|
+
`SSEWriter.accepts?` honors quality values and media-range precedence. An
|
|
69
|
+
explicit `text/event-stream;q=0` refuses SSE even with `*/*;q=1`. Empty media
|
|
70
|
+
parameters do not raise a server error. Rails returns 406 before resolving a
|
|
71
|
+
chat or reserving a run. Stream conflicts also return 409 in Rails hosts that
|
|
72
|
+
do not load Active Record; unrelated host errors still propagate.
|
|
73
|
+
|
|
74
|
+
## Refuse Malformed Text as a Client Error
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
RubyLLM::AgUI::Input.parse(body)
|
|
78
|
+
# => raises RubyLLM::AgUI::MalformedInputError (400)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
A body whose text is not UTF-8, or that holds a number JSON cannot represent,
|
|
82
|
+
is now refused as malformed input. The Rails adapter answers 400 instead of
|
|
83
|
+
raising `JSON::GeneratorError` as a server error.
|
|
84
|
+
|
|
85
|
+
## Reuse a Chat Across Turns
|
|
86
|
+
|
|
87
|
+
RubyLLM cannot remove a callback, so each run's callbacks stay on a chat you
|
|
88
|
+
reuse. A finished run now releases its response stream, and its callbacks map
|
|
89
|
+
and write nothing. A redaction policy object that defines only `#call` also
|
|
90
|
+
works now, alongside lambdas and methods.
|
|
91
|
+
|
|
92
|
+
## Upgrade From 0.4
|
|
93
|
+
|
|
94
|
+
Change the version in your Gemfile and run `bundle update ruby_llm-ag_ui`.
|
|
95
|
+
Records written by 0.4 stay readable. The release rehearsal reconnects to a 0.4
|
|
96
|
+
run and resumes a 0.4 interrupt with 1.0. Follow
|
|
97
|
+
[Upgrading]({% link _reference/upgrading.md %}) for the steps.
|
|
98
|
+
|
|
99
|
+
## Next Steps
|
|
100
|
+
|
|
101
|
+
* [Compatibility]({% link _reference/compatibility.md %}) - read the 1.0 release evidence.
|
|
102
|
+
* [Public API Contract]({% link _reference/public-api.md %}) - review the API 1.0 stabilizes.
|
|
103
|
+
* [Release History]({% link _reference/release-history.md %}) - compare earlier releases.
|
|
@@ -11,7 +11,8 @@ description: Browse RDoc pages generated from classes and methods in the gem sou
|
|
|
11
11
|
{{ page.description }}
|
|
12
12
|
{: .fs-6 .fw-300 }
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Read the [Public API Contract]({% link _reference/public-api.md %}) before
|
|
15
|
+
depending on a class. The [API reference]({{ '/api/' | relative_url }}) opens on the `RubyLLM` module. The generated pages follow the RDoc comments in `lib/`.
|
|
15
16
|
|
|
16
17
|
| Build with | Reference |
|
|
17
18
|
| --- | --- |
|