[PR #2171] [MERGED] mods: command.run-quiet (API level 3): a batch of commands with nothing in the chat #4072

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

📋 Pull Request Information

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

Base: main ← Head: feat/mod-run-quiet


📝 Commits (2)

  • fb86430 mods: command.run-quiet (API level 3), a batch of commands with nothing in the chat
  • c5f9e34 Merge remote-tracking branch 'origin/main' into feat/mod-run-quiet

📊 Changes

12 files changed (+149 additions, -7 deletions)

View changed files

📝 crates/cargo-horizon-mod/src/check.rs (+3 -0)
📝 crates/horizon-client/src/game/mods.rs (+56 -0)
📝 crates/horizon-client/src/game/remote.rs (+8 -0)
📝 crates/horizon-client/src/net.rs (+4 -0)
📝 crates/horizon-mod-sdk/wit/horizon.wit (+8 -0)
📝 crates/horizon-mods/src/api_level.rs (+3 -2)
📝 crates/horizon-mods/src/runtime.rs (+23 -0)
📝 crates/horizon-mods/tests/sandbox.rs (+27 -1)
📝 crates/horizon-mods/tests/ui_guest/src/lib.rs (+14 -2)
📝 docs/api/mods-reference.md (+1 -0)
📝 docs/api/stability.md (+1 -1)
📝 docs/mods.md (+1 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

The mod side of quiet commands: command.run-quiet(lines), API level 3. It is stacked on #2140 (the server and the protocol), so review that one first. command.run is unchanged.

What

  • WIT (command interface): run-quiet: func(lines: list<string>). It takes at most 256 lines a call, and each line is cut to 256 characters.
    • Level 3 in api_level.rs.
    • Documented in docs/api/stability.md and docs/mods.md (regenerated docs/api/mods-reference.md).
  • Where the lines go:
    • Single player, in-frame: each line runs as the player typing it would, with the player's source made silent (vanilla's withSuppressedOutput). A line that carries a chat message (say, msg) is refused. The game logs one line per batch.
    • Horizon servers (the server thread, LAN hosts and dedicated servers announce horizon:quiet_commands in the configuration phase): the batch goes as one payload (or a few, if it is long). The server checks each line with the player's own rights, runs at most 64 a tick and logs one line per batch (#2140).
    • Any other server: the lines fall back to chat commands. Their feedback shows there, and the docs say so: a mod that runs many commands should warn its players.
  • cargo horizon-mod check lists the quiet commands a mod ran.

Tests

  • sandbox.rs quiet_commands_come_out_as_one_batch_capped: the test guest's 300 lines come out as one batch of 256.
  • In game, with the test guest's /quiet and /quiet_many, both single-player paths. Each run printed nothing of the batch in the chat, and the setblock ran:
    • in-frame: "[mod test_ui_guest] ran 3 quiet command(s): 2 failed", then "ran 256";
    • server thread (the payload path, through the memory connection): "Player… ran 3 quiet command(s) from mod test_ui_guest: 2 failed".
  • Against the vanilla 26.3 server jar, the fallback ran the line as a chat command: the setblock feedback shows and the server ran it.
  • The dedicated server's permission checks (a non-op's quiet setblock is refused) are covered by #2140's tools/quiet_commands_e2e.py.

pr_ready (tools/pr_ready.py --quick --base feat/quiet-commands-server on ludovics-mac-mini, 21 min 51 s)

Check Result
Scope ✅ 12 files, +149 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅
clippy ✅ after the fix below (cargo clippy --workspace --all-targets -D warnings)
tests: horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest ✅ 1367 passed
doc tests ✅ 2 passed
launcher rustfmt / clippy / tests ✅ / ✅ / ✅ 132 passed
Parity ➖ 115 affected, to run in CI (--quick)

The first pr_ready run found cargo-horizon-mod's check missing the new Output arm. The fix is in this commit, and clippy over the workspace plus cargo test -p cargo-horizon-mod (3 passed) were rerun after it.

skip-release: an API addition. Players get something only when a mod uses it.

🤖 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/2171 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/mod-run-quiet` --- ### 📝 Commits (2) - [`fb86430`](https://github.com/horizon-rust/horizon/commit/fb8643081370f15bf6ca0695d3cb41df0d9e658a) mods: command.run-quiet (API level 3), a batch of commands with nothing in the chat - [`c5f9e34`](https://github.com/horizon-rust/horizon/commit/c5f9e3404cfed8c20edc41c346a2f5789521be09) Merge remote-tracking branch 'origin/main' into feat/mod-run-quiet ### 📊 Changes **12 files changed** (+149 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/cargo-horizon-mod/src/check.rs` (+3 -0) 📝 `crates/horizon-client/src/game/mods.rs` (+56 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+8 -0) 📝 `crates/horizon-client/src/net.rs` (+4 -0) 📝 `crates/horizon-mod-sdk/wit/horizon.wit` (+8 -0) 📝 `crates/horizon-mods/src/api_level.rs` (+3 -2) 📝 `crates/horizon-mods/src/runtime.rs` (+23 -0) 📝 `crates/horizon-mods/tests/sandbox.rs` (+27 -1) 📝 `crates/horizon-mods/tests/ui_guest/src/lib.rs` (+14 -2) 📝 `docs/api/mods-reference.md` (+1 -0) 📝 `docs/api/stability.md` (+1 -1) 📝 `docs/mods.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The mod side of **quiet commands**: `command.run-quiet(lines)`, API level 3. It is stacked on #2140 (the server and the protocol), so review that one first. `command.run` is unchanged. ## What - **WIT** (`command` interface): `run-quiet: func(lines: list<string>)`. It takes at most 256 lines a call, and each line is cut to 256 characters. - Level 3 in `api_level.rs`. - Documented in `docs/api/stability.md` and `docs/mods.md` (regenerated `docs/api/mods-reference.md`). - **Where the lines go:** - **Single player, in-frame:** each line runs as the player typing it would, with the player's source made silent (vanilla's `withSuppressedOutput`). A line that carries a chat message (`say`, `msg`) is refused. The game logs one line per batch. - **Horizon servers** (the server thread, LAN hosts and dedicated servers announce `horizon:quiet_commands` in the configuration phase): the batch goes as one payload (or a few, if it is long). The server checks each line with the player's own rights, runs at most 64 a tick and logs one line per batch (#2140). - **Any other server:** the lines fall back to chat commands. Their feedback shows there, and the docs say so: a mod that runs many commands should warn its players. - `cargo horizon-mod check` lists the quiet commands a mod ran. ## Tests - `sandbox.rs` `quiet_commands_come_out_as_one_batch_capped`: the test guest's 300 lines come out as one batch of 256. - In game, with the test guest's `/quiet` and `/quiet_many`, both single-player paths. Each run printed nothing of the batch in the chat, and the setblock ran: - in-frame: "[mod test_ui_guest] ran 3 quiet command(s): 2 failed", then "ran 256"; - server thread (the payload path, through the memory connection): "Player… ran 3 quiet command(s) from mod test_ui_guest: 2 failed". - Against the **vanilla 26.3 server jar**, the fallback ran the line as a chat command: the setblock feedback shows and the server ran it. - The dedicated server's permission checks (a non-op's quiet `setblock` is refused) are covered by #2140's `tools/quiet_commands_e2e.py`. **pr_ready** (`tools/pr_ready.py --quick --base feat/quiet-commands-server` on ludovics-mac-mini, 21 min 51 s) | Check | Result | | --- | --- | | Scope | ✅ 12 files, +149 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ | | clippy | ✅ after the fix below (`cargo clippy --workspace --all-targets -D warnings`) | | tests: horizon-client, horizon-mod-sdk, horizon-mods, horizon-mods-test-ui-guest | ✅ 1367 passed | | doc tests | ✅ 2 passed | | launcher rustfmt / clippy / tests | ✅ / ✅ / ✅ 132 passed | | Parity | ➖ 115 affected, to run in CI (--quick) | The first pr_ready run found `cargo-horizon-mod`'s `check` missing the new `Output` arm. The fix is in this commit, and clippy over the workspace plus `cargo test -p cargo-horizon-mod` (3 passed) were rerun after it. `skip-release`: an API addition. Players get something only when a mod uses it. 🤖 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-03 04:14:29 +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#4072
No description provided.