feat(bridge): console commands as event steps — command.run (PLAN_REDESIGNS §16, D382-D385) #41
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/command-steps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The bridge half of PLAN_REDESIGNS §16: a
command.runframe (protocol 14, PROTOCOL.md §20.11) that runs console commands a step's author typed.teardownis stored with the key, not run (D385).{steamid}, and{name}as one argument quoted the way the game's ownBuildCommandquotes one. Offline recipients are skipped and named (D383).{ key, teardownOf }runs the teardown kept under another key, at most once, and only where something may have run. This covers a step that failed part-way or whose answer was lost: core reverts those with only the key (D385).data/RunicGateway/commands-run.jsonbefore anything runs (kept 7 days, at most 500 keys). A repeat answers from the record; a repeat while the run is still going joins it; a run a reload cut off answersinterrupted.unknown-command:ConsoleSystem.Runreturns null both for an unknown command and for one that replies nothing. So each command runs while the bridge listens to Unity's log for the game's ownCommand '…' not foundline, which is logged synchronously inside the call.EventsEnabledgates it like every world verb.rg.worldshowscommandKeysandcommandsRunning.Tested
Run's return for unknown, silent and plugin commands;QuoteSafequoting;;does not split a command.node scripts/checkPlugin.jsand its tests pass.Walk rows (§16.9) join the end walk (D331).
Pairs with Rust-Link (
POST /commands/run), Module-Rust (the two steps) and docs (PROTOCOL §20.11, PLAN_REDESIGNS §16.10).🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
A `command.run` frame (protocol 14, PROTOCOL.md §20.11) runs the console commands a step's author typed: once, or once per online recipient with {steamid} and {name} filled in (the name quoted the way the game's own BuildCommand quotes an argument). D382-D384: no allowlist; offline recipients are skipped and named. - At most once per key: the key is written to commands-run.json before anything runs; a repeat answers from the record, a repeat while running joins the running job, a record a reload interrupted answers `interrupted`. Kept 7 days, at most 500 records. - Spread over frames: whole recipients per frame, up to 30 commands or 8 ms. - unknown-command: ConsoleSystem.Run returns null both for an unknown command and for one that replies nothing, so the run listens to Unity's log for the game's own "Command '...' not found" line while each command runs (spiked on Oxide 2.0.7830 and Carbon 2.0.262, Rust 25902425). The same capture is the reply when Run returns nothing. - rg.world shows commandKeys and commandsRunning. Compiled on both rigs and driven through a throwaway plugin (repeat key, unknown command, offline recipients, malformed requests); rigs restored to the protocol-13 bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeYCore records nothing for a step that failed or whose answer was lost, and then reverts it with only the key: no server, no teardown. So a run request now carries its `teardown`, stored in the key's record and never run with it, and `{ key, teardownOf }` runs the teardown stored under `teardownOf`, under its own key, at most once: - only when something there may have run (some commands ran, or a reload cut the run off); otherwise answered with nothing run and nothing kept; - `busy` while the run it is for is still going; - a reward carries no teardown (refused `malformed`), and a teardown takes no placeholders. Re-compiled and driven on both rigs (a failed run's teardown ran once, a repeat ran nothing, nothing-ran and unknown keys ran nothing); rigs restored to the protocol-13 bridge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY