openui-rails 0.1.0 → 0.2.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/AUDIT.md +24 -4
- data/CHANGELOG.md +28 -1
- data/CONFIGURATION.md +9 -77
- data/CONTRIBUTING.md +29 -1
- data/DEVELOPMENT.md +68 -0
- data/README.md +49 -439
- data/RELEASING.md +18 -8
- data/THIRD_PARTY_NOTICES.md +10 -0
- data/UPGRADING.md +7 -24
- data/lib/generators/openui/install/install_generator.rb +6 -5
- data/lib/generators/openui/install/templates/config/initializers/openui.rb.tt +2 -2
- data/lib/generators/openui/install/templates/config/openui/README.md +19 -4
- data/lib/openui/rails/default_library/library.prompt.txt +198 -0
- data/lib/openui/rails/default_library/library.spec.json +4390 -0
- data/lib/openui/rails/default_library/openui.LICENSE.txt +21 -0
- data/lib/openui/rails/default_library/provenance.json +15 -0
- data/lib/openui/rails/default_library.rb +85 -0
- data/lib/openui/rails/doctor.rb +143 -0
- data/lib/openui/rails/library_manifest.rb +2 -1
- data/lib/openui/rails/version.rb +1 -1
- data/lib/openui/rails.rb +2 -0
- data/lib/tasks/openui.rake +19 -0
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5999111a7f7f05fa709fd9e247a29d54cb817e07d6152caeac3413ac0eb82655
|
|
4
|
+
data.tar.gz: 530bcdc1b2c261e49cb8db318f330dc9c31dc7d9fbb9b7e9cc48d8ead04edd2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4018f00dba918786dc8d3addbb96209fe055c09b84bf1bbae7f595fad3f114cd25a58b54ef0cccb0bac349865871ba98b43fd7fab240448d3639582d7d84b9d3
|
|
7
|
+
data.tar.gz: ae6065874f65fe3e37e4133322bf698c4c90a74e4126b2efcc4f3c94df51dac927ea89ec403159d466a84f348d67d29b0a70345b4642f7b08dae64690d07b5f9
|
data/AUDIT.md
CHANGED
|
@@ -4,10 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
The audit found real defects despite the original green test suite. The fixes
|
|
6
6
|
below have regression coverage. The owner authorized publication of `0.1.0`
|
|
7
|
-
on 2026-10-18.
|
|
8
|
-
|
|
7
|
+
on 2026-10-18. The exact tag's complete CI and protected publishing workflow
|
|
8
|
+
passed, and `0.1.0` is published on RubyGems and GitHub. This audit establishes
|
|
9
9
|
the specific behaviors below, not the absence of all bugs.
|
|
10
10
|
|
|
11
|
+
## Publication evidence
|
|
12
|
+
|
|
13
|
+
- Release tag `v0.1.0` points to commit
|
|
14
|
+
`e2203c0e0f573f1b8206d9abdac4ab8f838594b8`.
|
|
15
|
+
- [Publishing run 39115168826](https://github.com/yorzi/openui-rails/actions/runs/39115168826)
|
|
16
|
+
passed the complete reusable CI suite, package checks, protected environment
|
|
17
|
+
approval, RubyGems upload, and GitHub release draft creation.
|
|
18
|
+
- [RubyGems 0.1.0](https://rubygems.org/gems/openui-rails/versions/0.1.0) and
|
|
19
|
+
[GitHub Release v0.1.0](https://github.com/yorzi/openui-rails/releases/tag/v0.1.0)
|
|
20
|
+
expose the same artifact. SHA-256:
|
|
21
|
+
`275c124a9e8e9c82b471357e3f314e4c86d6255c8fc9ef0313be858525bffee5`.
|
|
22
|
+
The actual RubyGems download, GitHub asset, API digest, and `SHA256SUMS` match.
|
|
23
|
+
- The downloaded RubyGems artifact passed the fresh Rails host probe: install
|
|
24
|
+
generator, eager load, and HTTP rendering.
|
|
25
|
+
- [Documentation](https://openui-rails.wangyaodi.com/) uses GitHub Pages with
|
|
26
|
+
Actions. Cloudflare has a DNS-only CNAME to `yorzi.github.io`. GitHub verified
|
|
27
|
+
domain ownership through a TXT record and issued the certificate. HTTPS is
|
|
28
|
+
enforced. The release docs build checks stable and `/next/` channels.
|
|
29
|
+
|
|
11
30
|
## Confirmed defects corrected
|
|
12
31
|
|
|
13
32
|
| Area | Defect | Correction and evidence |
|
|
@@ -71,8 +90,9 @@ complete accessibility, legal clearance, or an absence of future vulnerabilities
|
|
|
71
90
|
`release`.
|
|
72
91
|
- The repository is public. Security reports go to the address in `SECURITY.md`;
|
|
73
92
|
public support uses GitHub Issues.
|
|
74
|
-
- RubyGems
|
|
75
|
-
|
|
93
|
+
- RubyGems Trusted Publishing for the exact workflow and environment was
|
|
94
|
+
successfully used for the first release. The public version page identifies
|
|
95
|
+
the GitHub Actions repository, workflow, and environment as its publisher.
|
|
76
96
|
- The GitHub `release` environment requires approval by `yorzi`, allows the
|
|
77
97
|
`main` branch only, and disallows administrator bypass. Self-review remains
|
|
78
98
|
available for the single maintainer.
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,32 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.0] - 2026-10-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `openui:library:prepare` installs prompt/spec exports of the exact pinned
|
|
14
|
+
default chat library and its upstream license without browser or Node tools.
|
|
15
|
+
Existing different files require explicit overwrite; outputs stay inside
|
|
16
|
+
the application root.
|
|
17
|
+
- `openui:doctor` reports local configuration, default library identity,
|
|
18
|
+
runtime checksums, and action-route failures without writes or network calls.
|
|
19
|
+
Browser setup and host policy checks remain explicitly unverified.
|
|
20
|
+
- Local `bin/check` and disposable `bin/check-browser` runners, with fixture
|
|
21
|
+
screenshots on both passing and failing tests and the same browser entry
|
|
22
|
+
point in CI.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- The install generator leads with the default chat library and setup checks.
|
|
27
|
+
Custom libraries retain the pinned CLI path and require a matching runtime.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Manifest name queries now read name-keyed collections used by the official
|
|
32
|
+
default-library spec, as well as the previously supported array format.
|
|
33
|
+
Fingerprint calculation is unchanged.
|
|
34
|
+
|
|
9
35
|
## [0.1.0] - 2026-10-18
|
|
10
36
|
|
|
11
37
|
### Fixed
|
|
@@ -67,5 +93,6 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
67
93
|
- Gem-scoped RubyGems Trusted Publishing through GitHub OIDC, with a protected
|
|
68
94
|
release environment and verified artifact handoff.
|
|
69
95
|
|
|
70
|
-
[Unreleased]: https://github.com/yorzi/openui-rails/compare/v0.
|
|
96
|
+
[Unreleased]: https://github.com/yorzi/openui-rails/compare/v0.2.0...main
|
|
97
|
+
[0.2.0]: https://github.com/yorzi/openui-rails/releases/tag/v0.2.0
|
|
71
98
|
[0.1.0]: https://github.com/yorzi/openui-rails/releases/tag/v0.1.0
|
data/CONFIGURATION.md
CHANGED
|
@@ -1,79 +1,11 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
| `local_runtime_path` | `"/openui"` | Public URL directory for self-hosted assets. |
|
|
13
|
-
| `runtime_version` | pinned `0.2.1` | The fetch task accepts only the checksum-locked version. Other versions are unverified. |
|
|
14
|
-
| `runtime_url` | derived self-hosted JS URL | Explicit override for a host-built or external runtime. |
|
|
15
|
-
| `runtime_integrity` | pinned hash for the default runtime | Override for another JS asset. No default hash is assumed for custom URLs. |
|
|
16
|
-
| `runtime_stylesheet_url` | derived self-hosted CSS URL | Required when using `:external` and `openui_stylesheet_tag`. |
|
|
17
|
-
| `runtime_stylesheet_integrity` | pinned hash for the default runtime | Override for another CSS asset. |
|
|
18
|
-
| `actions_endpoint` | `"/openui-rails/actions"` | Must match the host engine mount. |
|
|
19
|
-
| `stream_byte_limit` | `1_048_576` | Positive integer; enforced by server writer and browser. |
|
|
20
|
-
| `pending_byte_limit` | `32_768` | Positive byte-based flush threshold, at most the stream limit. Lower it for smaller, more frequent updates. There is no timer-based flush. |
|
|
21
|
-
| `idempotency_ttl` | `900` seconds | Finite positive number. Replays are protected only within the store's lifetime and TTL. |
|
|
22
|
-
| `idempotency_store` | process-local `MemoryStore` | Use a shared atomic store for multiple processes. See the contract below. |
|
|
23
|
-
| `idempotency_scope` | derived actor/tenant identity | Optional callable receiving `Invocation`; return a stable, JSON-serializable namespace for custom identity types. |
|
|
24
|
-
| `actor_resolver` | host `current_user`, if available | Callable receiving the engine controller. Host authentication filters are inherited. |
|
|
25
|
-
| `surface_resolver` | `nil` | Callable `(surface_id, actor:, context:)`; return the scoped surface, or `nil` to deny. Without it, the authorizer owns resource/version checks. |
|
|
26
|
-
| `authorize_action` | `nil` | Global authorizer receiving `Invocation`. Missing authorization denies the action. Per-action `authorize:` takes precedence. |
|
|
27
|
-
| `on_error` | `nil` | Server stream-error hook `(error, message_id:)`. Do not log credentials or unredacted provider requests. |
|
|
28
|
-
| `action_registry` | lazy `Actions::Registry` | Allowlisted action definitions. |
|
|
29
|
-
|
|
30
|
-
`library_name` and `surface_id_param` are legacy metadata settings. They do not
|
|
31
|
-
select a runtime library or change the endpoint's `surface_id` wire key.
|
|
32
|
-
|
|
33
|
-
After you create the library files, call
|
|
34
|
-
`OpenUI::Rails.configuration.validate!` to check required configuration and
|
|
35
|
-
read the actual manifest and configured prompt files.
|
|
36
|
-
Boot does not call it automatically, so setup tasks can run before files exist.
|
|
37
|
-
|
|
38
|
-
## Shared idempotency store
|
|
39
|
-
|
|
40
|
-
The dispatcher supplies a SHA-256 key scoped to server actor and tenant identity.
|
|
41
|
-
It supplies a digest of the entire validated request separately.
|
|
42
|
-
|
|
43
|
-
```ruby
|
|
44
|
-
claim(key, ttl:, digest:)
|
|
45
|
-
# => [:claimed, nil, digest, claim_token] # this request owns execution
|
|
46
|
-
# => [:pending, nil, stored_digest, token] # execution is in progress
|
|
47
|
-
# => [:replay, result, stored_digest, token] # completed, including nil/false
|
|
48
|
-
|
|
49
|
-
record(key, result, claim_token: token)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Implement `claim` atomically. Make `claim_token` unique for every new claim.
|
|
53
|
-
Ignore a `record` call whose token no longer owns the key. Preserve completed
|
|
54
|
-
`nil` and `false` results instead of treating them as pending.
|
|
55
|
-
|
|
56
|
-
The default identity is `[class, id]` for records and `[class, value]` for scalar
|
|
57
|
-
identities. Unsupported identity objects need `idempotency_scope`. Scope must
|
|
58
|
-
come from trusted server state, not a client-supplied user or tenant ID.
|
|
59
|
-
|
|
60
|
-
A failed handler leaves a pending claim until expiry because its side effects
|
|
61
|
-
may already have happened. A handler that outlives the TTL can overlap a later
|
|
62
|
-
claim. Choose a suitable TTL and enforce business-level uniqueness or
|
|
63
|
-
transactions for irreversible operations. Process-local memory does not survive
|
|
64
|
-
restarts and cannot coordinate separate workers.
|
|
65
|
-
|
|
66
|
-
## Browser errors and recovery
|
|
67
|
-
|
|
68
|
-
Listen for `openui:error` to show a host-owned error or fallback. Listen for
|
|
69
|
-
`openui:snapshot-required` to fetch an authorized, authoritative snapshot.
|
|
70
|
-
The bridge emits these events; it does not implement the host's fallback UI,
|
|
71
|
-
snapshot endpoint, reconnection policy, or persistence.
|
|
72
|
-
|
|
73
|
-
The action bridge rejects authentication redirects and non-JSON, malformed, or
|
|
74
|
-
mismatched results. An expired-session redirect emits `unauthorized`; a broken
|
|
75
|
-
response contract emits `invalid_response`. Host callbacks may still redirect
|
|
76
|
-
HTTP requests, but a redirect is never a successful JSON action result.
|
|
77
|
-
|
|
78
|
-
Configure a matching manifest in production. Without one, the bridge cannot
|
|
79
|
-
verify that the model prompt, stored output, and runtime library agree.
|
|
3
|
+
Use the [configuration guide](https://openui-rails.wangyaodi.com/configuration/)
|
|
4
|
+
for settings, defaults, and the shared idempotency-store contract.
|
|
5
|
+
Review [production setup](https://openui-rails.wangyaodi.com/production/)
|
|
6
|
+
before deploying.
|
|
7
|
+
|
|
8
|
+
The site documents the latest release. For `main`, use
|
|
9
|
+
[/next/configuration/](https://openui-rails.wangyaodi.com/next/configuration/).
|
|
10
|
+
To read offline, open the [guide source](docs/_getting_started/configuration.md)
|
|
11
|
+
at the tag matching your installed gem.
|
data/CONTRIBUTING.md
CHANGED
|
@@ -14,12 +14,18 @@ bundle exec bin/rails db:test:prepare
|
|
|
14
14
|
|
|
15
15
|
## Before you open a pull request
|
|
16
16
|
|
|
17
|
+
Use `bin/check` for the local lint, unit/integration, RubyLLM, and built-gem
|
|
18
|
+
checks. Add `--browser` for deterministic browser tests and `--docs` for the
|
|
19
|
+
versioned site build. For the real runtime, fetch its pinned assets explicitly
|
|
20
|
+
and pass `--runtime tmp/real-runtime`. See [agent verification](DEVELOPMENT.md)
|
|
21
|
+
for focused runs, screenshots, and test boundaries.
|
|
22
|
+
|
|
17
23
|
```bash
|
|
18
24
|
bundle exec bin/rails test # unit + integration tests
|
|
19
25
|
bundle exec bin/rails test:system # browser (system) tests, needs Chrome
|
|
20
26
|
bundle exec rubocop # style (rubocop-rails-omakase)
|
|
21
27
|
bundle exec gem build openui-rails.gemspec
|
|
22
|
-
bundle exec ruby bin/smoke-package openui-rails-0.
|
|
28
|
+
bundle exec ruby bin/smoke-package openui-rails-0.2.0.gem
|
|
23
29
|
bundle exec bundler-audit check --update
|
|
24
30
|
bundle exec ruby -Itest test/compatibility/ruby_llm_smoke.rb
|
|
25
31
|
```
|
|
@@ -57,6 +63,28 @@ cases.
|
|
|
57
63
|
prompt CLI; pin exact versions.
|
|
58
64
|
- Write commit messages that explain the *why*.
|
|
59
65
|
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
Keep the README as a short introduction and navigation page. Write setup,
|
|
69
|
+
configuration, feature guides, and API contracts in `docs/`; the root
|
|
70
|
+
`CONFIGURATION.md` and `UPGRADING.md` link there. Keep contributor instructions,
|
|
71
|
+
security policy, release procedures, and audit evidence in the repository.
|
|
72
|
+
|
|
73
|
+
Use [ROADMAP.md](ROADMAP.md) for proposed work toward 1.0. Record delivered
|
|
74
|
+
changes in [CHANGELOG.md](CHANGELOG.md). A planned API is not a supported API.
|
|
75
|
+
Update the relevant guide with each public API change and add migration steps
|
|
76
|
+
when existing applications need changes.
|
|
77
|
+
|
|
78
|
+
Build documentation before submitting it:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
docs/bin/build.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The build includes the release docs at `/` and your working tree at `/next/`.
|
|
85
|
+
Preview with `docs/bin/serve.sh`; it binds to `127.0.0.1:4000`. Stop it when you
|
|
86
|
+
finish reviewing.
|
|
87
|
+
|
|
60
88
|
## Reporting security issues
|
|
61
89
|
|
|
62
90
|
Please do not open a public issue for a security problem. See `SECURITY.md`.
|
data/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Development and verification
|
|
2
|
+
|
|
3
|
+
Use `test/dummy` as the maintained local host. Temporary generated hosts verify
|
|
4
|
+
the built gem. Keep examples synthetic and provider-free unless a task explicitly
|
|
5
|
+
authorizes a live call. Follow this loop for each feature:
|
|
6
|
+
|
|
7
|
+
1. Reproduce the behavior with a focused test through its public entry point.
|
|
8
|
+
2. Implement the change and update its guide in the same commit.
|
|
9
|
+
3. Run the focused checks, then `bin/check`. Run database suites sequentially.
|
|
10
|
+
4. For browser behavior, run the relevant suite, inspect its screenshots, and
|
|
11
|
+
use browser tools for keyboard, layout, or mobile questions left unresolved.
|
|
12
|
+
5. Commit a completed unit with its actual verification results. Stop any
|
|
13
|
+
task-owned service before finishing.
|
|
14
|
+
|
|
15
|
+
## Checks
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
bin/check
|
|
19
|
+
bin/check --browser --docs
|
|
20
|
+
# Requires npm and network only for this explicit fetch:
|
|
21
|
+
bundle exec rake "app:openui:runtime:fetch[$PWD/tmp/real-runtime]"
|
|
22
|
+
bin/check-browser --runtime tmp/real-runtime
|
|
23
|
+
# Run all local checks including both browser layers:
|
|
24
|
+
bin/check --runtime tmp/real-runtime --docs
|
|
25
|
+
# Focus on one browser test file:
|
|
26
|
+
bin/check-browser test/system/openui_confirmation_system_test.rb
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Chrome is required. Set `CHROME_BIN` for a nonstandard executable. Selenium
|
|
30
|
+
manages the driver; its first run may need a download. Each browser run uses a
|
|
31
|
+
temporary SQLite database and stores passed and failed fixture screenshots in
|
|
32
|
+
the printed `tmp/browser/` directory. Screenshots are evidence for visual
|
|
33
|
+
review, not a substitute for assertions. Logs, databases, and screenshots stay
|
|
34
|
+
in ignored directories. Do not put production data in them.
|
|
35
|
+
|
|
36
|
+
The Capybara server and driver port probe bind loopback. Test processes close
|
|
37
|
+
their browser sessions and remove the temporary database on exit. This is not
|
|
38
|
+
a browser network sandbox. The stub suite exercises bridge failure cases; the
|
|
39
|
+
real-runtime suite verifies the pinned renderer, library identity, actions,
|
|
40
|
+
tools, and keyboard behavior. Neither proves live-provider compatibility.
|
|
41
|
+
|
|
42
|
+
## Refresh the default library exports
|
|
43
|
+
|
|
44
|
+
When changing the pinned runtime, regenerate from its checksum-verified bundle:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
bin/export-default-library tmp/real-runtime
|
|
48
|
+
bin/export-default-library tmp/real-runtime --check
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This maintainer command uses the existing Selenium/Chrome development tools,
|
|
52
|
+
closes the browser afterward, and preserves the upstream license and provenance.
|
|
53
|
+
Review the generated files and run the real-runtime tests. Applications use the
|
|
54
|
+
exported files inside the gem and need none of these browser tools for preparation.
|
|
55
|
+
|
|
56
|
+
## Installed artifact and release checks
|
|
57
|
+
|
|
58
|
+
`bin/check` builds into `tmp/package/` and tests a new Rails host using that
|
|
59
|
+
artifact. It verifies default library preparation, repeat runs, overwrite
|
|
60
|
+
rejection, missing-setup doctor exits, eager load, and HTTP mount rendering.
|
|
61
|
+
With `--runtime`, it also verifies a successful doctor report, actual rendering,
|
|
62
|
+
an explicitly authorized CSRF-protected action, and a 390px mobile page in a
|
|
63
|
+
fresh host. The host reads its prompt/spec from the gem, never test fixtures.
|
|
64
|
+
Fixture screenshots use the same `tmp/browser/` tree. CI runs this path too.
|
|
65
|
+
This does not establish external adoption or remote CI success.
|
|
66
|
+
Dependency-advisory refreshes remain explicit network operations; run
|
|
67
|
+
`bundle exec bundler-audit check --update` before a release. Follow
|
|
68
|
+
[Releasing](RELEASING.md) for the remaining publication checks.
|