ruby_llm-ag_ui 0.1.0 → 0.3.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +44 -0
  3. data/CONTRIBUTING.md +27 -3
  4. data/README.md +39 -115
  5. data/docs/_advanced/client-example.md +107 -0
  6. data/docs/_advanced/rails-integration.md +5 -2
  7. data/docs/_advanced/security-and-deployment.md +1 -1
  8. data/docs/_advanced/worker-recovery.md +104 -0
  9. data/docs/_core_features/cancellation.md +84 -0
  10. data/docs/_core_features/reconnects.md +13 -1
  11. data/docs/_core_features/streaming-runs.md +15 -0
  12. data/docs/_core_features/tool-progress.md +90 -0
  13. data/docs/_getting_started/configuration.md +2 -1
  14. data/docs/_getting_started/whats-new-in-0-3.md +61 -0
  15. data/docs/_reference/compatibility.md +83 -15
  16. data/docs/_reference/protocol-coverage.md +6 -5
  17. data/docs/_reference/release-history.md +4 -2
  18. data/docs/_reference/releasing.md +25 -0
  19. data/docs/_reference/upgrading.md +32 -18
  20. data/docs/{_getting_started → _reference}/whats-new-in-0-1.md +2 -1
  21. data/docs/_reference/whats-new-in-0-2.md +54 -0
  22. data/lib/ruby_llm/ag_ui/configuration.rb +7 -1
  23. data/lib/ruby_llm/ag_ui/coverage.rb +2 -2
  24. data/lib/ruby_llm/ag_ui/emitter.rb +5 -1
  25. data/lib/ruby_llm/ag_ui/error.rb +13 -2
  26. data/lib/ruby_llm/ag_ui/error_sanitizer.rb +1 -0
  27. data/lib/ruby_llm/ag_ui/mapper.rb +20 -1
  28. data/lib/ruby_llm/ag_ui/persistence.rb +18 -0
  29. data/lib/ruby_llm/ag_ui/rails/active_record_store.rb +21 -11
  30. data/lib/ruby_llm/ag_ui/rails/record.rb +8 -3
  31. data/lib/ruby_llm/ag_ui/rails/streaming.rb +3 -3
  32. data/lib/ruby_llm/ag_ui/redaction.rb +1 -0
  33. data/lib/ruby_llm/ag_ui/resume.rb +14 -6
  34. data/lib/ruby_llm/ag_ui/run.rb +33 -23
  35. data/lib/ruby_llm/ag_ui/run_record.rb +17 -4
  36. data/lib/ruby_llm/ag_ui/sse_writer.rb +16 -4
  37. data/lib/ruby_llm/ag_ui/store/base.rb +25 -2
  38. data/lib/ruby_llm/ag_ui/store/memory_store.rb +3 -7
  39. data/lib/ruby_llm/ag_ui/version.rb +1 -1
  40. metadata +30 -3
@@ -42,8 +42,23 @@ An assistant message opens on its first non-empty chunk and closes before a tool
42
42
 
43
43
  The run record reaches a terminal state before the terminal event is written. If the connection closes in the middle, the record remains available for a later reconnect.
44
44
 
45
+ ## When the Client Disconnects
46
+
47
+ The producer detaches a failed transport and continues the same chat turn while
48
+ its worker stays alive. A broken connection does not cancel the provider or
49
+ undo a tool. The store retains the real success, failure, approval pause, or
50
+ cancelled outcome. A retry while the turn is running is refused; after it ends,
51
+ the same input and run id receive the recorded outcome without execution.
52
+
53
+ This also applies when the first write or a flush fails. A terminal write
54
+ failure cannot replace an outcome that is already persisted. `SSEWriter` used
55
+ directly raises `TransportError`, a subclass of `StreamError`; `Run` handles
56
+ that transport error. Mapping and persistence errors are separate failures.
57
+
45
58
  ## Next Steps
46
59
 
47
60
  * [Validating Input]({% link _core_features/input-validation.md %}) - parse untrusted request data.
61
+ * [Tool Progress]({% link _core_features/tool-progress.md %}) - publish local tool updates.
62
+ * [Cancellation and Timeouts]({% link _core_features/cancellation.md %}) - connect host cancellation to the active chat.
48
63
  * [Approval and Resume]({% link _core_features/approval-and-resume.md %}) - answer an interrupt on a new run.
49
64
  * [Reconnects and Run Identity]({% link _core_features/reconnects.md %}) - serve a completed run again.
@@ -0,0 +1,90 @@
1
+ ---
2
+ layout: default
3
+ title: Tool Progress
4
+ nav_order: 5
5
+ description: Publish local tool progress as redacted AG-UI activity snapshots.
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 enable tool progress globally or for one run.
16
+ * How progress snapshots identify a tool call and replace earlier values.
17
+ * How to choose which progress values reach the client.
18
+
19
+ ## Enable Progress
20
+
21
+ Long tools can report their work before the result arrives. Enable progress
22
+ when your client handles AG-UI activity messages:
23
+
24
+ ```ruby
25
+ RubyLLM::AgUI.configure do |config|
26
+ config.emit_tool_progress = true
27
+ end
28
+ ```
29
+
30
+ The default is `false`. You can override it on one run with
31
+ `Run.new(chat: chat, input: input, scope: scope, store: store,
32
+ emit_tool_progress: true)`. Set the per-run option to `false` to disable a global
33
+ opt-in. The Rails concern uses the global setting.
34
+
35
+ The gem listens to RubyLLM's `after_tool_progress(tool_call, progress)` callback.
36
+ Your RubyLLM tool reports progress through its own `progress` method. The gem
37
+ publishes only values that the tool reports; it does not estimate a percentage
38
+ or make up a total.
39
+
40
+ ## Choose a Redaction Policy
41
+
42
+ Progress can include private messages. Its values pass through the configured
43
+ redactor with kind `:tool_progress`. The default replaces each reported value
44
+ with `[redacted]`, including numeric values. The tool call identifier remains
45
+ available so the client can associate the activity with the existing call.
46
+
47
+ For example, a host can publish counts while withholding messages:
48
+
49
+ ```ruby
50
+ RubyLLM::AgUI.configure do |config|
51
+ config.emit_tool_progress = true
52
+ config.redact = lambda do |kind, payload|
53
+ if kind == :tool_progress
54
+ payload.slice('value', 'total')
55
+ else
56
+ RubyLLM::AgUI::Redaction.default(kind, payload)
57
+ end
58
+ end
59
+ end
60
+ ```
61
+
62
+ Use `Redaction.method(:none)` only for host-approved public data. The same
63
+ policy still protects tool results with kind `:tool_result`.
64
+
65
+ ## Read an Activity Snapshot
66
+
67
+ With counts approved by the host, a tool update can produce:
68
+
69
+ ```json
70
+ {"type":"ACTIVITY_SNAPSHOT","messageId":"run-1:progress:call-1","activityType":"TOOL_PROGRESS","content":{"toolCallId":"call-1","progress":{"value":1,"total":3}},"replace":true}
71
+ ```
72
+
73
+ Each tool call has one activity id per run. Later updates replace that
74
+ activity's content. Unknown fields are absent: a message-only update has no
75
+ `value` or `total`. Empty progress updates produce no event.
76
+
77
+ Snapshots do not open another tool call, change an approval, or determine the
78
+ run outcome. Updates for a tool whose result has arrived are ignored, as are
79
+ callbacks after the run closes. Concurrent callbacks and run finalization use
80
+ the same lock so progress cannot be written after the terminal event.
81
+
82
+ Progress is not retained for reconnect. A completed-run reconnect serves its
83
+ recorded outcome and optional state snapshot, without replaying activity,
84
+ text, or tool deltas. No `ACTIVITY_DELTA` events are produced.
85
+
86
+ ## Next Steps
87
+
88
+ * [Client Example]({% link _advanced/client-example.md %}) - try a real client with offline tools.
89
+ * [Configuration]({% link _getting_started/configuration.md %}) - choose run defaults.
90
+ * [Protocol Coverage]({% link _reference/protocol-coverage.md %}) - inspect supported events.
@@ -32,12 +32,13 @@ p RubyLLM::AgUI.config.to_h[:redact]
32
32
 
33
33
  ## Settings
34
34
 
35
- The global configuration supplies defaults. `Run.new` can override the store, logger, redaction policy, clock, and interrupt expiry for one run. `MemoryStore` is process-local, so use a durable store when runs can move between workers.
35
+ The global configuration supplies defaults. `Run.new` can override the store, logger, redaction policy, clock, interrupt expiry, and tool progress for one run. `MemoryStore` is process-local, so use a durable store when runs can move between workers.
36
36
 
37
37
  | Setting | Default | Purpose |
38
38
  | --- | --- | --- |
39
39
  | `run_store` | `nil` | Store run records and interrupts. A run needs a store, supplied here or to `Run.new`. |
40
40
  | `redact` | `Redaction.default` | Transform tool results before they reach the stream. |
41
+ | `emit_tool_progress` | `false` | Publish tool progress as redacted activity snapshots. |
41
42
  | `logger` | `nil` | Receive host-side diagnostics without prompts or raw tool payloads. |
42
43
  | `protocol_version` | `"1.0"` | Value reported by `RUN_STARTED`. |
43
44
  | `max_input_bytes` | `256_000` | Maximum request body size. |
@@ -0,0 +1,61 @@
1
+ ---
2
+ layout: default
3
+ title: "What's New in 0.3"
4
+ nav_order: -1
5
+ description: Verify transport failure, scoped cancellation, and explicit worker recovery.
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 a run continues after its client disconnects.
16
+ * How to reconnect without executing a turn twice.
17
+ * How to recover after confirmed worker loss.
18
+ * How host cancellation differs from HTTP abort and provider timeout.
19
+
20
+ ## Keep the Recorded Outcome
21
+
22
+ ```ruby
23
+ record = RubyLLM::AgUI::Run.new(chat: chat, input: input, scope: scope,
24
+ store: store).stream(to: response_stream)
25
+ ```
26
+
27
+ If the response transport disconnects, the worker continues the same turn and
28
+ persists its real outcome. A failed terminal write cannot change an already
29
+ recorded result. This is not a background job: worker termination still stops
30
+ execution. See [Streaming Runs]({% link _core_features/streaming-runs.md %}).
31
+
32
+ ## Reconnect with the Same Input
33
+
34
+ Resend the original input and run id after completion. The store returns its
35
+ recorded outcome without running the chat or tool again. A second stream while
36
+ the original is still running is refused. See
37
+ [Reconnects and Run Identity]({% link _core_features/reconnects.md %}).
38
+
39
+ ## Recover Lost Workers Explicitly
40
+
41
+ After confirming a worker has stopped, load its authorized record and call
42
+ `store.recover(record)`. The recorded failure uses code `worker_lost` and keeps
43
+ the identity reserved. Stale record writes are refused by revision checks.
44
+ Storage acknowledgement failures propagate as `PersistenceError` rather than
45
+ inventing a terminal outcome. See
46
+ [Worker Recovery]({% link _advanced/worker-recovery.md %}).
47
+
48
+ ## Cancel the Authorized Run
49
+
50
+ The client example now shows separate controls for host cancellation and HTTP
51
+ abort. Its cancel endpoint checks the fixture actor and exact run identity;
52
+ disconnecting the browser leaves the producer running. RubyLLM's HTTP timeout
53
+ is recorded as `transport_timeout`, without raw provider details. See
54
+ [Cancellation and Timeouts]({% link _core_features/cancellation.md %}).
55
+
56
+ Version 0.3 adds independent-process SQLite tests, including a producer killed
57
+ after a synthetic tool effect.
58
+ These tests do not establish live provider or other-database behavior.
59
+
60
+ Before updating, read [Upgrading]({% link _reference/upgrading.md %}) for worker
61
+ draining, the custom-store contract, and the JSON 2.x dependency requirement.
@@ -21,15 +21,17 @@ dependency does.
21
21
 
22
22
  ## Supported versions
23
23
 
24
- | Component | Range | Verified |
24
+ | Component | Range | Evidence |
25
25
  |---|---|---|
26
- | Ruby | `>= 3.2` | 3.2, 3.3, 3.4 in CI; 3.3.5 locally |
26
+ | Ruby | `>= 3.2` | Recorded 0.3 CI passes on 3.2.11, 3.3.12, and 3.4.11 |
27
27
  | RubyLLM | `>= 2.1`, `< 3.0` | 2.1.1 (callback, approval and cancellation behavior read from its source) |
28
28
  | `ag-ui-protocol` | `~> 0.2.0` | 0.2.0 |
29
- | Rails (adapter only) | `railties`, `actionpack`, `activerecord` `>= 8.0` | 8.0.x and 8.1.x in CI |
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
31
  | AG-UI schema | pinned commit `89cedd3fd549feeee41e50e1d7c6d373e549241a` | vendored, SHA-256 recorded in [AG-UI Protocol Coverage]({% link _reference/protocol-coverage.md %}) |
31
32
 
32
- The pure-Ruby core depends only on `ruby_llm` and `ag-ui-protocol`. Rails,
33
+ The pure-Ruby core uses `ruby_llm` and `ag-ui-protocol`, plus the patched
34
+ standard-library gems required by the gemspec. Rails,
33
35
  `ToolViews`, `OpenUI` and `OddlyDock` are not runtime dependencies, and the Rails
34
36
  adapter is only loaded when `Rails::Railtie` is already defined.
35
37
 
@@ -52,15 +54,81 @@ adapter is only loaded when `Rails::Railtie` is already defined.
52
54
 
53
55
  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.
54
56
 
57
+ ## Local 0.3 Development Verification
58
+
59
+ On 2026-10-19, Ruby 3.3.5, RubyLLM 2.1.1, and Rails 8.1.4 pass 284 examples
60
+ with zero failures and one opt-in provider example skipped. The 18 browser
61
+ workflows pass with `@ag-ui/client` 1.0.3, Playwright 1.64.1, and Puma 8.0.2;
62
+ all 242 consumed events validate against the pinned schema. Desktop disconnect
63
+ and 390px cancellation screenshots were inspected.
64
+
65
+ Independent Ruby processes share one SQLite file to check reservations,
66
+ approval decisions, and competing outcome writes. Write barriers force both
67
+ processes to observe the old payload before either updates it. A producer
68
+ killed after a synthetic tool effect is explicitly recovered; reconnect never
69
+ executes the tool again. Mutation checks reject removal of either SQL compare
70
+ conditions or revision validation.
71
+
72
+ The real RubyLLM chat is also checked with intercepted HTTP: cancellation at
73
+ a checkpoint makes no provider request, and a request timeout produces a
74
+ sanitized, reconnectable failure. These tests make no live provider call.
75
+ Installed-host checks pass for both endpoints and generated Rails models.
76
+ ## Recorded 0.3 CI Verification
77
+
78
+ The [2026-10-20 CI run](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39375830117)
79
+ passes all ten jobs at `aa9e035`: Ruby 3.2.11, 3.3.12, and 3.4.11; Rails
80
+ 8.0.5.1 and 8.1.4 on Ruby 3.3/3.4; lint; installed-host checks; and the browser
81
+ suite on Ubuntu 24.04. Each test job passes 284 examples with zero failures
82
+ and one opt-in provider skip. The browser suite passes 18 workflows and
83
+ validates all 242 consumed events with `@ag-ui/client` 1.0.3.
84
+ It uses Playwright 1.64.1 and Chromium 156.0.8078.4. Desktop disconnection and
85
+ 390px cancellation screenshots from this run were inspected.
86
+
87
+ The first candidate failed when Rails 8.0 and JSON 3 loaded a real RubyLLM
88
+ chat. Version 0.3 bounds JSON to 2.x; the passing matrix uses 2.21.2. Intercepted
89
+ HTTP tests reproduce the failure before the bound and pass after it. These
90
+ checks make no live provider call.
91
+
92
+ ## Recorded 0.2 Client Verification
93
+
94
+ On 2026-10-19, the local 0.2.0 candidate passes the maintained browser workflows
95
+ with `@ag-ui/client` 1.0.3, Playwright 1.64.1, and Chrome 155.0.8059.82 on macOS.
96
+ Both the plain Ruby and Rails endpoints use scripted chats. Checks cover text,
97
+ a second turn, approval/denial, incremental progress before completion, default
98
+ tool-result redaction, sanitized failure, cancellation, and exact completed-run
99
+ reconnect, including a completed resume run. Captured events also validate
100
+ against the pinned schema. The progress demo publishes synthetic counts through
101
+ a host policy and withholds messages; unit tests check default progress redaction.
102
+
103
+ Run `bin/check-browser` to reproduce and inspect screenshots and events under
104
+ `tmp/browser/`. `bin/check --package` separately installs the built artifact
105
+ outside the checkout, checks both endpoints, and generates RubyLLM models and
106
+ ordered example migrations to verify scoped chat persistence. This package
107
+ probe uses available development dependencies; `bin/verify-package` checks a
108
+ clean gem home with freshly resolved dependencies.
109
+
110
+ The [2026-10-19 CI run](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39179834370)
111
+ passes all ten jobs at `4aba0dc`: the Ruby and Rails matrices above, lint,
112
+ installed-host verification, and the browser suite on Ubuntu 24.04.
113
+ The browser job uses Playwright's Chromium 156.0.8078.4 and passes all 12
114
+ scenarios, with 154 consumed events validated against the schema. Its desktop
115
+ progress and mobile denial screenshots were also inspected. These remain
116
+ synthetic checks; no live provider session is recorded.
117
+
118
+ The [0.2.0 release workflow](https://github.com/yorzi/ruby_llm-ag-ui/actions/runs/39180349362)
119
+ also passes browser, advisory, installed-host, and clean-install verification.
120
+ The published GitHub and RubyGems downloads have matching checksums. The actual
121
+ published artifact separately passes the installed-host and clean core/Rails
122
+ checks after download.
123
+
55
124
  ## What is not asserted
56
125
 
57
- - **Real AG-UI clients** (CopilotKit, `@ag-ui/client`, any other consumer). No
58
- client has been recorded against this producer. The events are schema-valid and
59
- the ordering rules the protocol documents are enforced, but "a specific client
60
- renders this correctly" is a separate claim, and it is not made here.
126
+ - **Other clients or versions.** CopilotKit and client versions other than the
127
+ recorded `@ag-ui/client` version have not been verified. Schema conformance
128
+ does not establish that every UI renders the events correctly.
61
129
  - **Live providers.** `spec/live/live_run_spec.rb` is the opt-in check
62
- (`RUBY_LLM_LIVE=1`, plus a provider key); it is skipped in the default suite.
63
- Provider behavior in 2.1.1 is derived from its source, not from a recorded
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
64
132
  session.
65
133
  - **Every RubyLLM patch release in the `>= 2.1, < 3.0` range.** The upper bound
66
134
  is enforced by the gemspec; the verified version is 2.1.1.
@@ -68,8 +136,8 @@ The RSpec suite runs offline with fakes and no provider credentials. Package ver
68
136
  initializer, and its specs run on 8.0/8.1. It may work on 7.2 and it is not
69
137
  tested there.
70
138
  - **Databases other than SQLite** for the ActiveRecord store. The store uses a
71
- unique index and `with_lock`; PostgreSQL and MySQL should behave the same, and
72
- that is untested.
139
+ unique index and conditional payload updates. PostgreSQL and MySQL are
140
+ untested; the SQLite checks do not establish their concurrency behavior.
73
141
 
74
142
  ## Deliberate behavior worth knowing
75
143
 
@@ -83,9 +151,9 @@ These are choices, not gaps, and each has a reason:
83
151
  repeating it would duplicate the call in the client's conversation.
84
152
  - **`MESSAGES_SNAPSHOT` is never produced.** History is the host's, and the gem
85
153
  will not re-id it. `STATE_SNAPSHOT` is produced, on a reconnect.
86
- - **No `ACTIVITY_*`, `REASONING_*`, `RAW` or `SUBAGENT_*` events.** RubyLLM 2.x
87
- exposes no data for them on the supported path, and the gem does not invent
88
- events. A thinking-only chunk produces nothing.
154
+ - **Tool progress is opt-in.** `ACTIVITY_SNAPSHOT` carries local tool progress
155
+ when enabled. `ACTIVITY_DELTA`, `REASONING_*`, `RAW` and `SUBAGENT_*` remain
156
+ unproduced. A thinking-only chunk produces nothing.
89
157
  - **Message ids are the gem's** (`run-<id>:a<n>`), scoped to the run, because
90
158
  RubyLLM streaming chunks carry no message id.
91
159
  - **Steps are per phase** (`completion`, `tool`), named `step-<n>` per run.
@@ -66,11 +66,12 @@ Legend:
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. |
68
68
 
69
- ### Optional (1)
69
+ ### Optional (2)
70
70
 
71
71
  | Event type | Family | When |
72
72
  |---|---|---|
73
73
  | `CUSTOM` | raw/custom | Only safe, documented host extensions. Nothing in the gem emits one today. |
74
+ | `ACTIVITY_SNAPSHOT` | activity | Local tool progress when `emit_tool_progress` is enabled, after host redaction. |
74
75
 
75
76
  ### Host-owned, not produced (2)
76
77
 
@@ -79,14 +80,13 @@ Legend:
79
80
  | `MESSAGES_SNAPSHOT` | state | The conversation belongs to the host. Producing one would mean re-synthesizing message ids the gem did not mint, which a client would then render as new messages. |
80
81
  | `STATE_DELTA` | state | Deltas describe a change the host made. The gem never invents a patch, and it has no API that publishes one. |
81
82
 
82
- ### Not produced (15)
83
+ ### Not produced (14)
83
84
 
84
85
  | Event type | Family | Why |
85
86
  |---|---|---|
86
87
  | `TEXT_MESSAGE_CHUNK` | text | Convenience form of the explicit triad; the gem emits `START`/`CONTENT`/`END`. |
87
88
  | `TOOL_CALL_CHUNK` | tool | Convenience form; the gem emits the explicit triad. |
88
- | `ACTIVITY_SNAPSHOT` | activity | No `ACTIVITY_*` projection yet; RubyLLM's progress signals are not mapped. |
89
- | `ACTIVITY_DELTA` | activity | Same: no progress projection, and no invented patches. |
89
+ | `ACTIVITY_DELTA` | activity | Progress uses full snapshots; no patches are produced. |
90
90
  | `RAW` | raw/custom | The gem never passes provider payloads through. |
91
91
  | `REASONING_START` | reasoning | Private reasoning is not emitted until a host opts in, and there is no opt-in yet. |
92
92
  | `REASONING_MESSAGE_START` | reasoning | A chunk that carries thinking is ignored. |
@@ -99,7 +99,7 @@ Legend:
99
99
  | `SUBAGENT_FINISHED` | subagents | Same. |
100
100
  | `SUBAGENT_ERROR` | subagents | Same. |
101
101
 
102
- Totals: 13 produced + 1 optional + 2 host-owned + 15 not produced = **31**.
102
+ Totals: 13 produced + 2 optional + 2 host-owned + 14 not produced = **31**.
103
103
 
104
104
  ## Terminal events
105
105
 
@@ -172,4 +172,5 @@ must produce no event at all.
172
172
  ## Next Steps
173
173
 
174
174
  * [Streaming Runs]({% link _core_features/streaming-runs.md %}) - follow event order and outcomes.
175
+ * [Tool Progress]({% link _core_features/tool-progress.md %}) - opt in to activity snapshots.
175
176
  * [Compatibility]({% link _reference/compatibility.md %}) - see what this repository verifies.
@@ -11,12 +11,14 @@ description: Review RubyLLM AG-UI releases, newest first, with highlights and up
11
11
  {{ page.description }}
12
12
  {: .fs-6 .fw-300 }
13
13
 
14
- {% if site.docs_unreleased %}This build follows `main`. The latest stable release is `{{ site.version }}`.
14
+ {% if site.docs_unreleased %}This build follows `main` for version `{{ site.version }}` development. Select Stable in the version menu for the published release.
15
15
  {% else %}This documentation describes version `{{ site.version }}`. Use its tag and release notes to identify the exact source.
16
16
  {% endif %}
17
17
 
18
18
  | Release | Date | Highlights |
19
19
  | --- | --- | --- |
20
- | [0.1.0](https://github.com/yorzi/ruby_llm-ag-ui/releases/tag/v0.1.0) | 2026-10-18 | [First release]({% link _getting_started/whats-new-in-0-1.md %}): AG-UI event mapping, approval and resume, cancellation, reconnect, and the optional Rails adapter |
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 |
21
+ | [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
+ | [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 |
21
23
 
22
24
  To move an application from one release to the next, follow [Upgrading]({% link _reference/upgrading.md %}).
@@ -20,16 +20,31 @@ After reading this guide, you will know:
20
20
 
21
21
  ```bash
22
22
  bundle exec rake
23
+ npm ci
24
+ bin/check-browser
23
25
  bundle exec bundle-audit check --update
24
26
  bundle exec rake build
27
+ bundle exec ruby scripts/check_package_host.rb --built
25
28
  bundle exec ruby bin/verify-package --rails --audit
26
29
  docs/bin/build.sh
30
+ python3 scripts/check_docs_links.py
27
31
  ```
28
32
 
29
33
  The package check installs dependencies in a fresh temporary gem home and requires the installed artifact from outside the checkout. It verifies the core entrypoint, shipped templates and guides, and input parsing. With `--rails`, it invokes the documented generator and migrates its table up and down in SQLite. With `--audit`, it checks the actually activated core dependencies against the advisory database.
30
34
 
31
35
  These checks make no live provider call. Keep provider and client interoperability evidence in [Compatibility]({% link _reference/compatibility.md %}).
32
36
 
37
+ Install the documentation bundle before building the site: run `bundle install`
38
+ from `docs/`. API HTML and Markdown use the RDoc version locked in that bundle,
39
+ so local and CI builds use the same navigation and parser.
40
+
41
+ ## Review Release Scope
42
+
43
+ Use the repository's [roadmap](https://github.com/yorzi/ruby_llm-ag-ui/blob/main/ROADMAP.md)
44
+ for proposed iterations and the 1.0 release conditions. Guides describe available
45
+ behavior; the roadmap describes planned work. Check the release's conditions
46
+ before preparing its tag.
47
+
33
48
  ## Configure Trusted Publishing
34
49
 
35
50
  Before the first tag, register a pending trusted publisher on RubyGems with gem name `ruby_llm-ag_ui`, GitHub owner `yorzi`, repository `ruby_llm-ag-ui`, workflow `release.yml`, and environment `release`. The workflow uses a short-lived GitHub OIDC identity instead of a stored RubyGems API key.
@@ -52,3 +67,13 @@ Replace the example tag with the version you are releasing. The `Release Gem` wo
52
67
  On success, the workflow creates a GitHub Release with the gem, checksum, and CHANGELOG notes. The Docs workflow runs after the release workflow succeeds. It publishes the tagged version at `/` and current `main` at `/next/`.
53
68
 
54
69
  Check the version on RubyGems, the GitHub Release assets, and the documentation installation command. If a publish attempt fails, inspect its logs before retrying. A published RubyGems version cannot be overwritten.
70
+
71
+ Download the published gem from both RubyGems and the GitHub Release. Compare
72
+ their SHA-256 hashes with the release's `SHA256SUMS` and RubyGems metadata.
73
+ Verify that its packaged files match the tag. The publish job builds its own
74
+ artifact, so a verification job's earlier hash is not proof of the public bytes.
75
+
76
+ Place the downloaded gem under `pkg/` and repeat the installed-host check with
77
+ `--built`, followed by `bin/verify-package --rails --audit`. Do not rebuild the
78
+ gem between downloading and checking it. Confirm the rendered stable and
79
+ `/next/` guides, API links, and version menu after the Docs deployment succeeds.
@@ -15,28 +15,42 @@ 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
- ## One Release at a Time
18
+ ## Move from 0.2 to 0.3
19
19
 
20
- Version `0.1.0` is the first release. There is no earlier published version to upgrade from. Start with [Getting Started]({% link _getting_started/getting-started.md %}). For future releases, upgrade one release at a time.
21
-
22
- ## Install Version 0.1
20
+ Drain your old workers, change your Gemfile, and update the dependency:
23
21
 
24
22
  ```ruby
25
- gem 'ruby_llm-ag_ui', '~> 0.1.0'
23
+ gem 'ruby_llm-ag_ui', '~> 0.3.0'
26
24
  ```
27
25
 
28
- If you used an untagged development checkout, review [Configuration]({% link _getting_started/configuration.md %}) and [Rails Integration]({% link _advanced/rails-integration.md %}) before changing the dependency. No compatibility with earlier untagged checkouts is promised.
29
-
30
- ## Use the Full Generator Command
31
-
32
- Untagged development checkouts registered the shorter `ruby_llm:ag_ui` namespace. Version 0.1 registers the documented installation command:
33
-
34
- ```bash
35
- # Before, on an untagged checkout
36
- bin/rails generate ruby_llm:ag_ui
37
-
38
- # Version 0.1
39
- bin/rails generate ruby_llm:ag_ui:install
26
+ ```sh
27
+ bundle update ruby_llm-ag_ui
40
28
  ```
41
29
 
42
- Existing generated tables and initializers do not need to be regenerated for this command-name correction.
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 %}).
52
+
53
+ ## Older Releases
54
+
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).
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  layout: default
3
3
  title: "What's New in 0.1"
4
- nav_order: 0
4
+ nav_order: 1
5
+ parent: Release History
5
6
  description: Use the first RubyLLM AG-UI release to stream, resume, cancel, and reconnect agent runs.
6
7
  ---
7
8
 
@@ -0,0 +1,54 @@
1
+ ---
2
+ layout: default
3
+ title: "What's New in 0.2"
4
+ nav_order: 2
5
+ parent: Release History
6
+ description: Verify real AG-UI client workflows and opt in to redacted tool progress.
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
+ * How to publish tool progress without exposing private messages.
17
+ * How to run the maintained browser client example.
18
+ * Which client checks run offline and which provider checks remain separate.
19
+
20
+ ## Publish Tool Progress
21
+
22
+ Enable activity snapshots when your client supports them:
23
+
24
+ ```ruby
25
+ RubyLLM::AgUI.configure do |config|
26
+ config.emit_tool_progress = true
27
+ end
28
+ ```
29
+
30
+ Progress is off by default. Each tool call has a stable activity id and later
31
+ snapshots replace earlier values. Values pass through the host redaction policy;
32
+ late callbacks cannot write after the run closes. See
33
+ [Tool Progress]({% link _core_features/tool-progress.md %}).
34
+
35
+ ## Run the Official Client Locally
36
+
37
+ ```sh
38
+ bundle install
39
+ npm ci
40
+ bin/check-browser
41
+ ```
42
+
43
+ The maintained example connects a pinned official `@ag-ui/client` to plain Ruby
44
+ and Rails endpoints. It covers text, a second turn, approval/denial, progress,
45
+ completed-run reconnect, sanitized failure, and cancellation outcomes. The Rails
46
+ endpoint uses a generated migration and temporary SQLite database. See
47
+ [Client Example]({% link _advanced/client-example.md %}).
48
+
49
+ Browser screenshots, event traces, and schema validation are local fixture
50
+ evidence. They do not establish live provider behavior, all-client compatibility,
51
+ or remote CI success. The opt-in live spec now shares an actor-scoped setup
52
+ with an offline harness check. See
53
+ [Compatibility]({% link _reference/compatibility.md %}) and
54
+ [Upgrading]({% link _reference/upgrading.md %}) before updating your application.
@@ -28,6 +28,10 @@ module RubyLLM
28
28
  # RubyLLM::AgUI::Redaction.method(:none), or replace it with your policy.
29
29
  attr_writer :redact
30
30
 
31
+ # Whether runs publish local tool progress as activity snapshots. Off
32
+ # unless the host opts in; progress payloads still pass through redaction.
33
+ attr_accessor :emit_tool_progress
34
+
31
35
  # A Logger used for host-side diagnostics. Never receives prompts, raw
32
36
  # tool payloads or credentials.
33
37
  attr_accessor :logger
@@ -71,6 +75,7 @@ module RubyLLM
71
75
  @interrupt_ttl = 900
72
76
  @clock = -> { Time.now.utc }
73
77
  @allow_client_history = false
78
+ @emit_tool_progress = false
74
79
  end
75
80
 
76
81
  # The redaction policy in force. Never nil: an unset or nil policy falls
@@ -105,7 +110,8 @@ module RubyLLM
105
110
  max_tools: max_tools,
106
111
  max_context: max_context,
107
112
  interrupt_ttl: interrupt_ttl,
108
- allow_client_history: allow_client_history
113
+ allow_client_history: allow_client_history,
114
+ emit_tool_progress: emit_tool_progress
109
115
  }
110
116
  end
111
117
  end
@@ -66,8 +66,8 @@ module RubyLLM
66
66
  'MESSAGES_SNAPSHOT' => [:host_owned, 'Not produced: history is the host\'s; ids are never re-synthesized.'],
67
67
  'STATE_SNAPSHOT' => [:produced, 'Reconnect: the state the host gave the run, never replayed deltas.'],
68
68
  'STATE_DELTA' => [:host_owned, 'Not produced: patches are the host\'s to describe; the gem invents none.'],
69
- 'ACTIVITY_SNAPSHOT' => [:not_produced, 'No ACTIVITY_* projection yet; after_tool_progress is not mapped.'],
70
- 'ACTIVITY_DELTA' => [:not_produced, 'No ACTIVITY_* projection yet; the gem does not invent patches.'],
69
+ 'ACTIVITY_SNAPSHOT' => [:optional, 'Opt-in local tool progress, after host redaction.'],
70
+ 'ACTIVITY_DELTA' => [:not_produced, 'Progress uses full snapshots; the gem does not invent patches.'],
71
71
  'REASONING_START' => [:not_produced, 'Private reasoning is not emitted until a host opts in.'],
72
72
  'REASONING_MESSAGE_START' => [:not_produced, 'Never emitted; a chunk that carries thinking is ignored.'],
73
73
  'REASONING_MESSAGE_CONTENT' => [:not_produced, 'Never emitted; a chunk that carries thinking is ignored.'],
@@ -94,7 +94,11 @@ module RubyLLM
94
94
  private
95
95
 
96
96
  def emit(event)
97
+ return if @detached
98
+
97
99
  @writer.write(event)
100
+ rescue TransportError
101
+ @detached = true
98
102
  end
99
103
 
100
104
  # Closes whatever content is still open, then writes the terminal event.
@@ -108,7 +112,7 @@ module RubyLLM
108
112
  end
109
113
 
110
114
  def persist(record)
111
- @store.save(record)
115
+ Persistence.write { @store.save(record) }
112
116
  end
113
117
 
114
118
  def now