[PR #349] [MERGED] Agent control: the widget tree of every screen, click and set by id #2510

Closed
opened 2026-11-02 15:56:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/agent-ui-tree


📝 Commits (1)

  • 8c5d1ed Agent control: the widget tree of every screen, click and set by id

📊 Changes

15 files changed (+603 additions, -60 deletions)

View changed files

📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+13 -1)
📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/agent.rs (+3 -3)
📝 crates/horizon-client/src/game/control.rs (+20 -7)
📝 crates/horizon-client/src/game/pad_menu.rs (+1 -1)
📝 crates/horizon-client/src/game/station_control.rs (+1 -1)
➕ crates/horizon-client/src/game/ui_control.rs (+206 -0)
📝 crates/horizon-client/src/multiplayer.rs (+9 -4)
📝 crates/horizon-client/src/options_ui.rs (+8 -1)
📝 crates/horizon-client/src/title.rs (+7 -2)
📝 crates/horizon-client/src/ui.rs (+7 -7)
📝 crates/horizon-client/src/ui_theme.rs (+53 -16)
📝 crates/horizon-client/src/widgets.rs (+177 -5)
📝 docs/native-client.md (+12 -0)
📝 tools/agent_control_e2e.py (+82 -12)

📄 Description

What. Step 2 of docs/agent-control.md (#321):

  • ui: every widget the last frame drew, on every screen (title menus, pause, options in both menu styles, inventories, containers, stations): id, kind (button, slider with its 0..1 value, field, row, tab with selected, slot with its stack), label, bounds in GUI pixels, enabled, plus screen, gui_size and frame
  • ids are readable and stable: label up to its : as a slug (FOV: 70 → fov, Video Settings... → video-settings), -2 for repeats, row-0/field-0 without a label, slot-<ID> for slots (the ids of click-slot); world/server/language rows carry their names, Horizon switches/sliders/segments their row's caption (vsync, menu-style-horizon); off-screen layout probes are left out
  • click ID [right] [shift] clicks through the same window events as the mouse (slots go through click-slot); set ID VALUE moves a slider by clicking its track at VALUE, as AbstractSliderButton.setValueFromMouse reads it; errors name the widgets on screen
  • after a click or set, the next ui/click/set waits for a redrawn frame (max 1 s), so it never reads the screen the click left
  • horizon-ctl and its MCP gain ui, click, set and launch --offscreen (MCP clients can now start the game headless)
  • tools/agent_control_e2e.py: a ui scenario (world created, options changed, crafting done, all by widget id), runs offscreen on macOS; both scenarios handle Singleplayer opening Create New World when there are no worlds (the survival one failed on that before)

Vanilla untouched. Labels are recorded in the widget registry the controller focus already uses; nothing is drawn differently. widgets::last() (click-button, screen, controller focus) still lists buttons only.

How tested.

cargo fmt --all --check: ok
cargo clippy --workspace --all-targets -- -D warnings: ok
cargo test -p horizon-client: 721 passed, 0 failed (at the top of the stack)
tools/parity.py --changed origin/main on the stack top (ui + options + waits, one integration run): 80 harnesses, 80 passed, 0 failed
  (the UI-tree branch alone: 80/80 before its last one-line tweak, then 60/78 of the rerun before the stack run took over)
tools/agent_control_e2e.py on the Mac mini, real game offscreen, CLI and MCP: survival PASS, ui PASS, options PASS, events PASS

Needs Ludovic. Nothing. Merge order: this, then options, then waits (stacked); #342 (launcher MCP) after this one.

🤖 Generated with Claude Code


🔄 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/349 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/agent-ui-tree` --- ### 📝 Commits (1) - [`8c5d1ed`](https://github.com/horizon-rust/horizon/commit/8c5d1ed86bcafe5a3fce108c7d22407f579ffc99) Agent control: the widget tree of every screen, click and set by id ### 📊 Changes **15 files changed** (+603 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+13 -1) 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/agent.rs` (+3 -3) 📝 `crates/horizon-client/src/game/control.rs` (+20 -7) 📝 `crates/horizon-client/src/game/pad_menu.rs` (+1 -1) 📝 `crates/horizon-client/src/game/station_control.rs` (+1 -1) ➕ `crates/horizon-client/src/game/ui_control.rs` (+206 -0) 📝 `crates/horizon-client/src/multiplayer.rs` (+9 -4) 📝 `crates/horizon-client/src/options_ui.rs` (+8 -1) 📝 `crates/horizon-client/src/title.rs` (+7 -2) 📝 `crates/horizon-client/src/ui.rs` (+7 -7) 📝 `crates/horizon-client/src/ui_theme.rs` (+53 -16) 📝 `crates/horizon-client/src/widgets.rs` (+177 -5) 📝 `docs/native-client.md` (+12 -0) 📝 `tools/agent_control_e2e.py` (+82 -12) </details> ### 📄 Description **What.** Step 2 of `docs/agent-control.md` (#321): - `ui`: every widget the last frame drew, on every screen (title menus, pause, options in both menu styles, inventories, containers, stations): `id`, `kind` (button, slider with its 0..1 `value`, field, row, tab with `selected`, slot with its `stack`), `label`, `bounds` in GUI pixels, `enabled`, plus `screen`, `gui_size` and `frame` - ids are readable and stable: label up to its `:` as a slug (`FOV: 70` → `fov`, `Video Settings...` → `video-settings`), `-2` for repeats, `row-0`/`field-0` without a label, `slot-<ID>` for slots (the ids of `click-slot`); world/server/language rows carry their names, Horizon switches/sliders/segments their row's caption (`vsync`, `menu-style-horizon`); off-screen layout probes are left out - `click ID [right] [shift]` clicks through the same window events as the mouse (slots go through `click-slot`); `set ID VALUE` moves a slider by clicking its track at VALUE, as `AbstractSliderButton.setValueFromMouse` reads it; errors name the widgets on screen - after a click or set, the next `ui`/`click`/`set` waits for a redrawn frame (max 1 s), so it never reads the screen the click left - `horizon-ctl` and its MCP gain `ui`, `click`, `set` and `launch --offscreen` (MCP clients can now start the game headless) - `tools/agent_control_e2e.py`: a `ui` scenario (world created, options changed, crafting done, all by widget id), runs offscreen on macOS; both scenarios handle Singleplayer opening Create New World when there are no worlds (the survival one failed on that before) **Vanilla untouched.** Labels are recorded in the widget registry the controller focus already uses; nothing is drawn differently. `widgets::last()` (click-button, `screen`, controller focus) still lists buttons only. **How tested.** ``` cargo fmt --all --check: ok cargo clippy --workspace --all-targets -- -D warnings: ok cargo test -p horizon-client: 721 passed, 0 failed (at the top of the stack) tools/parity.py --changed origin/main on the stack top (ui + options + waits, one integration run): 80 harnesses, 80 passed, 0 failed (the UI-tree branch alone: 80/80 before its last one-line tweak, then 60/78 of the rerun before the stack run took over) tools/agent_control_e2e.py on the Mac mini, real game offscreen, CLI and MCP: survival PASS, ui PASS, options PASS, events PASS ``` **Needs Ludovic.** Nothing. Merge order: this, then options, then waits (stacked); #342 (launcher MCP) after this one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:47 +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#2510
No description provided.