[PR #1864] [MERGED] Mod API: capability ui — mod-owned screens and settings pages #3827

Closed
opened 2026-11-03 04:12:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1864
Author: @socksprox
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: feat/mod-ui


📝 Commits (4)

  • af7a685 Mod API: capability ui — mod-owned screens and settings pages
  • f2832f8 check: cover the ui open/close-screen outputs
  • 05396b4 ui: experimental, opted into with experimental = ["ui"] in the manifest
  • befec19 ui: a Settings button appears when the mod sets its page later

📊 Changes

23 files changed (+988 additions, -35 deletions)

View changed files

📝 AGENTS.md (+1 -1)
📝 Cargo.lock (+7 -0)
📝 Cargo.toml (+1 -1)
📝 crates/cargo-horizon-mod/src/check.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+11 -0)
📝 crates/horizon-client/src/game/agent.rs (+1 -0)
📝 crates/horizon-client/src/game/control.rs (+1 -0)
📝 crates/horizon-client/src/game/mods.rs (+341 -1)
📝 crates/horizon-client/src/game/options.rs (+1 -0)
📝 crates/horizon-client/src/game/screens.rs (+2 -1)
📝 crates/horizon-client/src/game/startup_menu.rs (+2 -0)
📝 crates/horizon-client/src/mod_list.rs (+4 -0)
📝 crates/horizon-client/src/options_ui.rs (+31 -9)
📝 crates/horizon-mod-sdk/src/lib.rs (+32 -4)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+92 -0)
📝 crates/horizon-mods/src/manifest.rs (+46 -1)
📝 crates/horizon-mods/src/runtime.rs (+186 -14)
📝 crates/horizon-mods/tests/sandbox.rs (+50 -0)
➕ crates/horizon-mods/tests/ui_guest/Cargo.toml (+16 -0)
➕ crates/horizon-mods/tests/ui_guest/src/lib.rs (+66 -0)

...and 3 more files

📄 Description

🤖 Opened by socksprox's AI agent (Devin), not by socksprox.

What and why

Ships the ui interface from the roadmap ("widgets: text, item icons, lists, a screen the mod owns, a settings page in Options > Mods, built from vanilla's widgets so it matches the menus").

  • WIT: interface ui — text-widget, item-widget, list-widget, a screen record, open-screen, close-screen, set-settings — plus interface ui-events (select, closed, settings-opened), in a new world horizon-ui-mod (include horizon-mod), so mods built before it keep loading; a ui-host world holds the game's side.
  • Runtime: ui host calls are clipped (64 widgets, 512 rows, 256 chars) and retained like the HUD panel; ui-events is optional (old mods get no calls); screen open/close ride the Output channel.
  • SDK: targets horizon-ui-mod; Mod gains ui_select / ui_closed / ui_settings_opened, all defaulted so existing mods compile unchanged.
  • Game: Screen::Mod draws the pushed widgets with ui.rs (menu background, centered title, item icons via the real item renderer, scrollable pick-lists, Done/Esc). Options > Mods gains a Settings button on rows whose mod set a page.
  • Capability ui is declared in the manifest and checked against the component's real imports like every other one.

Vanilla reference

Horizon-only (vanilla has no mod API); screens are drawn with the same widget code as the menus so they look native.

Self-check

cargo fmt; cargo check -p horizon-client --features mods --bins and without the feature; cargo test -p horizon-mods --features runtime,pack --test sandbox — new test ui_screens_settings_and_events (screen push, select/closed/settings-opened callbacks, close) passes; docs/api/mods-reference.md regenerated (its test passes). CI runs the full pr_ready harness set.

Screenshots

None captured — needs a running game; a menu example mod can follow if wanted.

🤖 Generated with Devin


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1864 **Author:** [@socksprox](https://github.com/socksprox) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-ui` --- ### 📝 Commits (4) - [`af7a685`](https://github.com/horizon-rust/horizon/commit/af7a685b5c5871764b9c7b16d948b04dd2cdb867) Mod API: capability `ui` — mod-owned screens and settings pages - [`f2832f8`](https://github.com/horizon-rust/horizon/commit/f2832f83ef4e811e744312ac01117114a098f746) check: cover the ui open/close-screen outputs - [`05396b4`](https://github.com/horizon-rust/horizon/commit/05396b4edfd63209708ecbf767e0b93eea272272) ui: experimental, opted into with experimental = ["ui"] in the manifest - [`befec19`](https://github.com/horizon-rust/horizon/commit/befec1995f0cb89d11b4fd07354116805f6796a5) ui: a Settings button appears when the mod sets its page later ### 📊 Changes **23 files changed** (+988 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -1) 📝 `Cargo.lock` (+7 -0) 📝 `Cargo.toml` (+1 -1) 📝 `crates/cargo-horizon-mod/src/check.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+11 -0) 📝 `crates/horizon-client/src/game/agent.rs` (+1 -0) 📝 `crates/horizon-client/src/game/control.rs` (+1 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+341 -1) 📝 `crates/horizon-client/src/game/options.rs` (+1 -0) 📝 `crates/horizon-client/src/game/screens.rs` (+2 -1) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+2 -0) 📝 `crates/horizon-client/src/mod_list.rs` (+4 -0) 📝 `crates/horizon-client/src/options_ui.rs` (+31 -9) 📝 `crates/horizon-mod-sdk/src/lib.rs` (+32 -4) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+92 -0) 📝 `crates/horizon-mods/src/manifest.rs` (+46 -1) 📝 `crates/horizon-mods/src/runtime.rs` (+186 -14) 📝 `crates/horizon-mods/tests/sandbox.rs` (+50 -0) ➕ `crates/horizon-mods/tests/ui_guest/Cargo.toml` (+16 -0) ➕ `crates/horizon-mods/tests/ui_guest/src/lib.rs` (+66 -0) _...and 3 more files_ </details> ### 📄 Description > 🤖 Opened by socksprox's AI agent (Devin), not by socksprox. ## What and why Ships the `ui` interface from the roadmap ("widgets: text, item icons, lists, a screen the mod owns, a settings page in Options > Mods, built from vanilla's widgets so it matches the menus"). - **WIT**: `interface ui` — `text-widget`, `item-widget`, `list-widget`, a `screen` record, `open-screen`, `close-screen`, `set-settings` — plus `interface ui-events` (`select`, `closed`, `settings-opened`), in a new world `horizon-ui-mod` (`include horizon-mod`), so mods built before it keep loading; a `ui-host` world holds the game's side. - **Runtime**: `ui` host calls are clipped (64 widgets, 512 rows, 256 chars) and retained like the HUD panel; `ui-events` is optional (old mods get no calls); screen open/close ride the `Output` channel. - **SDK**: targets `horizon-ui-mod`; `Mod` gains `ui_select` / `ui_closed` / `ui_settings_opened`, all defaulted so existing mods compile unchanged. - **Game**: `Screen::Mod` draws the pushed widgets with `ui.rs` (menu background, centered title, item icons via the real item renderer, scrollable pick-lists, Done/Esc). Options > Mods gains a Settings button on rows whose mod set a page. - Capability `ui` is declared in the manifest and checked against the component's real imports like every other one. ## Vanilla reference Horizon-only (vanilla has no mod API); screens are drawn with the same widget code as the menus so they look native. ## Self-check `cargo fmt`; `cargo check -p horizon-client --features mods --bins` and without the feature; `cargo test -p horizon-mods --features runtime,pack --test sandbox` — new test `ui_screens_settings_and_events` (screen push, select/closed/settings-opened callbacks, close) passes; `docs/api/mods-reference.md` regenerated (its test passes). CI runs the full `pr_ready` harness set. ## Screenshots None captured — needs a running game; a `menu` example mod can follow if wanted. 🤖 Generated with Devin --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:36 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3827
No description provided.