rails_ai_admin 0.4.1 → 0.5.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 +64 -0
- data/README.md +4 -9
- data/SECURITY.md +1 -1
- data/app/assets/builds/rails_ai_admin.js +5 -5
- data/app/controllers/rails_ai_admin/application_controller.rb +19 -6
- data/app/controllers/rails_ai_admin/assistant_controller.rb +20 -7
- data/app/controllers/rails_ai_admin/audit_controller.rb +5 -1
- data/app/controllers/rails_ai_admin/bulk_changes_controller.rb +26 -6
- data/app/controllers/rails_ai_admin/dashboard_controller.rb +3 -2
- data/app/controllers/rails_ai_admin/deleted_records_controller.rb +12 -4
- data/app/controllers/rails_ai_admin/files_controller.rb +16 -4
- data/app/controllers/rails_ai_admin/mcp_controller.rb +30 -4
- data/app/controllers/rails_ai_admin/mcp_tokens_controller.rb +4 -2
- data/app/controllers/rails_ai_admin/operations_controller.rb +5 -2
- data/app/controllers/rails_ai_admin/resources_controller.rb +44 -5
- data/app/controllers/rails_ai_admin/selections_controller.rb +41 -5
- data/app/helpers/rails_ai_admin/assistant_helper.rb +3 -1
- data/app/helpers/rails_ai_admin/fields_helper.rb +36 -7
- data/app/helpers/rails_ai_admin/history_helper.rb +1 -1
- data/app/views/layouts/rails_ai_admin/application.html.erb +1 -0
- data/app/views/layouts/rails_ai_admin/frame.html.erb +1 -1
- data/app/views/layouts/rails_ai_admin/status.html.erb +2 -2
- data/app/views/rails_ai_admin/assistant/_transcript.html.erb +5 -1
- data/app/views/rails_ai_admin/audit/index.html.erb +1 -1
- data/app/views/rails_ai_admin/deleted_records/index.html.erb +3 -2
- data/app/views/rails_ai_admin/fields/_input.html.erb +2 -1
- data/app/views/rails_ai_admin/selections/confirm_destroy.html.erb +1 -0
- data/config/locales/en.yml +2 -0
- data/db/assistant_migrate/20261103000001_create_rails_ai_admin_assistant.rb +1 -0
- data/db/migrate/20261122000001_add_missing_indexes_to_rails_ai_admin_tables.rb +12 -0
- data/lib/generators/rails_ai_admin/assistant/assistant_generator.rb +4 -1
- data/lib/generators/rails_ai_admin/assistant/templates/admin_assistant.rb +6 -0
- data/lib/generators/rails_ai_admin/assistant/templates/assistant_eval.yml +25 -0
- data/lib/generators/rails_ai_admin/install/templates/admin_context_devise.rb.tt +2 -1
- data/lib/generators/rails_ai_admin/install/templates/admin_context_rails.rb.tt +5 -2
- data/lib/rails_ai_admin/assistant/budget.rb +4 -2
- data/lib/rails_ai_admin/assistant/coordinator.rb +18 -4
- data/lib/rails_ai_admin/assistant/evaluation.rb +124 -0
- data/lib/rails_ai_admin/assistant/records.rb +2 -1
- data/lib/rails_ai_admin/assistant/retention.rb +12 -1
- data/lib/rails_ai_admin/assistant/runtime.rb +49 -1
- data/lib/rails_ai_admin/assistant/tools.rb +58 -18
- data/lib/rails_ai_admin/assistant.rb +1 -0
- data/lib/rails_ai_admin/authorization/access.rb +34 -23
- data/lib/rails_ai_admin/authorization/pundit_adapter.rb +6 -3
- data/lib/rails_ai_admin/collections/dispatcher.rb +3 -3
- data/lib/rails_ai_admin/collections/queries.rb +1 -1
- data/lib/rails_ai_admin/configuration.rb +39 -8
- data/lib/rails_ai_admin/doctor.rb +44 -9
- data/lib/rails_ai_admin/field.rb +37 -22
- data/lib/rails_ai_admin/fields/association.rb +27 -10
- data/lib/rails_ai_admin/fields/type.rb +1 -1
- data/lib/rails_ai_admin/forms/plan.rb +4 -2
- data/lib/rails_ai_admin/input_schema.rb +4 -4
- data/lib/rails_ai_admin/integrations/propose_operation.rb +18 -4
- data/lib/rails_ai_admin/integrations/tool_views.rb +29 -3
- data/lib/rails_ai_admin/mcp.rb +23 -13
- data/lib/rails_ai_admin/navigation/list_state.rb +3 -3
- data/lib/rails_ai_admin/navigation/saved_views.rb +6 -5
- data/lib/rails_ai_admin/operations/restore.rb +25 -4
- data/lib/rails_ai_admin/operations/runner.rb +51 -15
- data/lib/rails_ai_admin/outbox/dispatcher.rb +6 -2
- data/lib/rails_ai_admin/presentation/association_panel.rb +6 -6
- data/lib/rails_ai_admin/presentation/audit_log.rb +8 -3
- data/lib/rails_ai_admin/presentation/csv_export.rb +21 -8
- data/lib/rails_ai_admin/presentation/csv_import.rb +9 -1
- data/lib/rails_ai_admin/presentation/dashboard.rb +5 -2
- data/lib/rails_ai_admin/presentation/history.rb +1 -1
- data/lib/rails_ai_admin/prune.rb +16 -5
- data/lib/rails_ai_admin/queries/list.rb +138 -38
- data/lib/rails_ai_admin/record_version.rb +1 -1
- data/lib/rails_ai_admin/registry.rb +5 -0
- data/lib/rails_ai_admin/request_log_filter.rb +4 -2
- data/lib/rails_ai_admin/resource.rb +4 -0
- data/lib/rails_ai_admin/schema_suggestions.rb +13 -5
- data/lib/rails_ai_admin/templates/catalog.rb +4 -2
- data/lib/rails_ai_admin/templates/inspector.rb +6 -2
- data/lib/rails_ai_admin/templates/safe_paths.rb +2 -1
- data/lib/rails_ai_admin/version.rb +1 -1
- data/lib/rails_ai_admin/work.rb +1 -1
- data/lib/rails_ai_admin.rb +10 -6
- data/lib/tasks/rails_ai_admin.rake +20 -0
- metadata +25 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1048026639656d2abbb66035b0e4eb7f61af3c1e13a9c1a410ddd999e0bb278f
|
|
4
|
+
data.tar.gz: 3eef016ef843b10035659e41bfdcbdd62186f9aca418f168320f85979dfb0025
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50f07590db991d7c6e38106a092e9dd0e4fd52e74d8f2f2ac62cb32a81ece9c2a6ee8b3fb0a136e0dc925482729ccee255a58e323576469fef35be348a505393
|
|
7
|
+
data.tar.gz: 85628d7724070553b9041d6d8f69620c8699a6ef3865044821f1bfb0a061793b81610b9dad2430b2148f8feafa2bb0f1f54b801dce9e9fb5b3e2e42f785e24c5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 (2026-11-22)
|
|
4
|
+
|
|
5
|
+
This Public Preview adds operator notes, fallback models, prompt caching,
|
|
6
|
+
calendar-period totals and an assistant evaluation task. Existing hosts need
|
|
7
|
+
the new index migration and should check their layout and bulk delete overrides.
|
|
8
|
+
See the [upgrade guide](https://rails-ai-admin.wangyaodi.com/upgrading/).
|
|
9
|
+
|
|
10
|
+
- A new engine migration indexes queued batch items, work deadlines, runs by selection and audit event, and the audit log by resource. Copy it with `bin/rails generate rails_ai_admin:install --skip`, then run `bin/rails db:migrate`.
|
|
11
|
+
- A bulk delete confirmation carries a signed list of the records it showed. If the records that can be deleted change before submission, nothing is deleted and the page reports a conflict. An override of `selections/confirm_destroy.html.erb` moves to contract 3 and must submit the `review_signature` field.
|
|
12
|
+
- The Pundit adapter grants an action only when the policy method returns exactly `true`, and never through a method that Ruby's `Object` defines. A policy that returns another truthy value now denies.
|
|
13
|
+
- `searchable:` takes `false`, `true`, `:prefix`, `:contains` or `:exact`, on text, textarea, email, url, enum, select and belongs_to fields only. Other declarations raise `ConfigurationError` at boot.
|
|
14
|
+
- Restoring a soft-deleted record runs its model validations. A record that no longer validates stays deleted, and the page reports a conflict.
|
|
15
|
+
- A Work handler's `lease_duration` must be longer than its `max_duration`.
|
|
16
|
+
- The assistant and MCP resolve reference labels, and search or sort through a reference, only for target resources that also grant `assistant?`. MCP tokens work only while their owner has the assistant on at least one resource. Proposals for disabled operations are refused, and a turn that hit the step limit can no longer be retried.
|
|
17
|
+
- Association panels and the deleted-records page leave out records the person may not show, instead of listing their labels. The audit log names an actor in its filter only when that actor appears in the visible log.
|
|
18
|
+
- Request logs filter the `Authorization` and `Cookie` headers. MCP reads at most its body limit before parsing and never parses an unauthenticated body. Files are served only for fields visible on the show or list page, with `frame-ancestors 'none'`. Rich text renders through a fixed tag allowlist, whatever the host's sanitizer settings. A rejected form never sends a password back to the browser. CSV export also escapes formulas that follow leading spaces.
|
|
19
|
+
- Models versioned only by `lock_version` now advance their version when an edit changes only files, rich text or a list, so a concurrent form conflicts. On PostgreSQL, locked lookups no longer combine `FOR UPDATE` with a policy's outer join, and a malformed key in a filter is refused instead of raising. The dashboard trend leaves out future dates, and `Time` values are no longer converted to UTC in place.
|
|
20
|
+
|
|
21
|
+
- `bin/rails rails_ai_admin:assistant:eval` asks the questions in
|
|
22
|
+
`config/rails_ai_admin/assistant_eval.yml` as one person, through the real
|
|
23
|
+
model, grants and operator notes, and checks the tools called, the answer
|
|
24
|
+
text and, with reference answers, the meaning. It exits with status 1 on a
|
|
25
|
+
failure. It is built on `RubyLLM::Evaluation`; the assistant generator writes
|
|
26
|
+
a starter file.
|
|
27
|
+
- The assistant asks the provider to cache its instructions and tool
|
|
28
|
+
definitions, which every request repeats. Anthropic models, directly or
|
|
29
|
+
through OpenRouter, bill them at the cache-read price after the first
|
|
30
|
+
request; the spend line shows tokens read from the cache. Set
|
|
31
|
+
`config.assistant_prompt_caching = false` for a compatible server that
|
|
32
|
+
rejects unknown fields.
|
|
33
|
+
- The assistant adapter may define `instructions(context:)` to explain the
|
|
34
|
+
business to the model. The text follows the admin's own rules as a second
|
|
35
|
+
system message on every turn, is never saved, and grants nothing.
|
|
36
|
+
- `config.assistant_fallback_models` lists up to three models RubyLLM tries
|
|
37
|
+
when the assistant model is rate limited, overloaded or unreachable. The
|
|
38
|
+
doctor names them.
|
|
39
|
+
- `aggregate_records` groups by calendar period: pass a date or datetime field
|
|
40
|
+
the person may filter by as `group_by`, with `period` set to `day`, `week`,
|
|
41
|
+
`month` or `year`. Periods run oldest first in the person's time zone,
|
|
42
|
+
include periods without records, and stop at the latest 25.
|
|
43
|
+
`describe_resource` lists these fields as `group_by_period`. The offline demo
|
|
44
|
+
answers `sum orders total by week of delivery_on`.
|
|
45
|
+
- The default layout loads Trix in its head whenever a resource has a
|
|
46
|
+
`rich_text` field. Opening an editor through a Turbo visit no longer shows
|
|
47
|
+
the link dialog open, with Trix styles refused by the page's style policy.
|
|
48
|
+
Layout overrides move to contract 5. Add `<%= admin_rich_text_assets %>` to
|
|
49
|
+
an overridden layout's head; until then, Trix keeps loading beside each editor.
|
|
50
|
+
- `bin/demo` follows the supported RubyLLM range instead of pinning 2.2.0, so
|
|
51
|
+
the demo runs the release the checkout was tested with.
|
|
52
|
+
- On a Rails version with `forgery_protection_verification_strategy` (Rails
|
|
53
|
+
main, 8.2.0.alpha), engine controllers use `:header_or_legacy_token` whatever
|
|
54
|
+
the host's default. Rails 8.2's `:header_only` accepts a plain-HTTP request
|
|
55
|
+
without `Sec-Fetch-Site`; the admin asks such a request for its token.
|
|
56
|
+
- The field input partial compiles through Herb, which `load_defaults 8.2`
|
|
57
|
+
uses for HTML templates: `case` and its first `when` are separate tags.
|
|
58
|
+
- The OpenRouter recordings were made again on 2026-11-22 with RubyLLM 2.2.3
|
|
59
|
+
and prompt caching on, adding active customers per month and operator notes
|
|
60
|
+
on `anthropic/claude-haiku-5.5`. The recorded evaluation passes 26 of 27
|
|
61
|
+
questions. Fallbacks and the evaluation task are tested against a scripted
|
|
62
|
+
provider only.
|
|
63
|
+
- A scheduled CI workflow runs the suite against Rails main on SQLite and
|
|
64
|
+
PostgreSQL (`gemfiles/rails_main.gemfile`). It warns early and does not
|
|
65
|
+
block releases; Rails 8.2 is not supported yet.
|
|
66
|
+
|
|
3
67
|
## 0.4.1 (2026-11-18)
|
|
4
68
|
|
|
5
69
|
This Public Preview patch fixes bulk reviews, joined lists, CSV imports and
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Rails AI Admin is a self-hosted admin engine for Rails. Give your team an admin
|
|
|
4
4
|
for the models you choose, then add a RubyLLM-powered assistant that can answer
|
|
5
5
|
questions about records and prepare changes for review.
|
|
6
6
|
|
|
7
|
-
**0.
|
|
7
|
+
**0.5.0 Public Preview** · [Documentation](https://rails-ai-admin.wangyaodi.com/) ·
|
|
8
8
|
[Quickstart](https://rails-ai-admin.wangyaodi.com/quickstart/) ·
|
|
9
9
|
[RubyGems](https://rubygems.org/gems/rails_ai_admin)
|
|
10
10
|
|
|
@@ -56,7 +56,7 @@ sources and more detail. Data as of November 2026.
|
|
|
56
56
|
Add the gem to your Gemfile and run `bundle install`:
|
|
57
57
|
|
|
58
58
|
```ruby
|
|
59
|
-
gem "rails_ai_admin", "~> 0.
|
|
59
|
+
gem "rails_ai_admin", "~> 0.5.0"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Requires Ruby 3.3+ and Rails 8.1.4.1+ (below 8.2). Rails 7 and 8.0 are not supported. See the [installation guide](https://rails-ai-admin.wangyaodi.com/getting-started/)
|
|
@@ -85,14 +85,9 @@ From a clone of this repository:
|
|
|
85
85
|
|
|
86
86
|
```sh
|
|
87
87
|
bundle install
|
|
88
|
-
bin/demo
|
|
88
|
+
bin/demo
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Open `http://127.0.0.1:3917/login
|
|
92
|
-
**Assistant → New conversation**. Try `search articles for upgrading`, followed
|
|
93
|
-
by `set articles 1 title to Hello` to see a change review. The demo uses seeded
|
|
94
|
-
data and an offline model; `bin/demo --openrouter` uses real models with an
|
|
95
|
-
`OPENROUTER_API_KEY` from your environment. Follow the [demo walkthrough](https://rails-ai-admin.wangyaodi.com/demo/)
|
|
96
|
-
for more examples.
|
|
91
|
+
Open `http://127.0.0.1:3917/login` and choose **Sign in as Admin**. Explore the dashboard and Articles, then ask the offline **Assistant** `set articles 1 title to Hello`. Review and confirm the change, then find it in **Audit log**. No API key is needed. Follow the [demo walkthrough](https://rails-ai-admin.wangyaodi.com/next/demo/) to try CSV, bulk reviews, permissions and MCP in the same demo.
|
|
97
92
|
|
|
98
93
|
[MIT License](LICENSE) · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md)
|
data/SECURITY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Security policy
|
|
2
2
|
|
|
3
|
-
0.
|
|
3
|
+
0.5.0 is the current Public Preview. Review the limitations in CHANGELOG.md and deploy
|
|
4
4
|
behind your host application's authentication and network controls. Verify
|
|
5
5
|
tenant scopes and action and field grants before granting access.
|
|
6
6
|
|