Skip to content

Feat: Refactor tuimon and add a bevy backend (prep for a browser mode)#901

Merged
gbin merged 15 commits into
masterfrom
gbin/bevy_monitor
Mar 7, 2026
Merged

Feat: Refactor tuimon and add a bevy backend (prep for a browser mode)#901
gbin merged 15 commits into
masterfrom
gbin/bevy_monitor

Conversation

@gbin

@gbin gbin commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Screencast_20260307_110920.mp4

Related issues

  • Closes #

Changes

Testing

  • just fmt
  • just lint
  • just test
  • optional full just std-ci (if std/runtime paths are impacted)
  • optional full just nostd-ci (if embedded/no_std paths are impacted)
  • Other (please specify):

pro-tip: just with no parameters in the root defaults to just fmt, just lint, and just test.

Checklist

  • I have updated docs or examples where needed
  • I have added or updated tests where needed
  • I have considered platform impact (Linux/macOS/Windows/embedded)
  • I have considered config/logging changes (if applicable)
  • This change is not a breaking change (or I documented it below)

Breaking changes (if any)

Additional context

@gbin gbin added enhancement New feature or request include in changelog labels Mar 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the monitor UI into a shared cu_tuimon library and introduces a new Bevy-backed monitor (cu_bevymon) plus an example app to demonstrate side-by-side sim + monitor rendering, as prep work for future non-terminal backends (e.g. browser/wasm).

Changes:

  • Extract shared monitor state + Ratatui rendering + log pane plumbing into new components/libs/cu_tuimon.
  • Rework cu_consolemon to delegate UI rendering and (optional) log pane behavior to cu_tuimon.
  • Add new cu_bevymon monitor + Bevy plugin (bundled fonts, focus/viewport helpers) and a cu_bevymon_demo example.

Reviewed changes

Copilot reviewed 32 out of 35 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/cu_bevymon_demo/src/tasks.rs Adds synthetic Copper tasks/payloads for demo runtime + logging.
examples/cu_bevymon_demo/src/main.rs Bevy demo app: split layout, focus routing, viewport syncing, Copper runtime driver.
examples/cu_bevymon_demo/copperconfig.ron Demo Copper graph + logging + monitor selection.
examples/cu_bevymon_demo/build.rs Sets LOG_INDEX_DIR env var for build output.
examples/cu_bevymon_demo/README.md Documents demo purpose and controls.
examples/cu_bevymon_demo/Cargo.toml New example crate deps (Bevy + cu-bevymon + Copper crates).
components/monitors/cu_consolemon/src/lib.rs Refactors console monitor to use shared cu_tuimon::MonitorUi and MonitorModel.
components/monitors/cu_consolemon/src/debug_pane.rs Removes old bespoke debug pane implementation.
components/monitors/cu_consolemon/README.md Updates screen descriptions to match shared log pane behavior.
components/monitors/cu_consolemon/Cargo.toml Switches debug pane feature to cu-tuimon feature flags; trims old deps.
components/monitors/cu_bevymon/src/viewport.rs Adds helper to sync Bevy camera viewports to UI panel rects.
components/monitors/cu_bevymon/src/terminal.rs Adds SoftBackend Ratatui terminal resource with embedded fonts + resize helper.
components/monitors/cu_bevymon/src/lib.rs Implements CuMonitor + Bevy plugin: input translation, drawing, texture upload.
components/monitors/cu_bevymon/src/focus.rs Adds click-to-focus surface tracking + focus border updates + cursor mapping helpers.
components/monitors/cu_bevymon/assets/fonts/OFL.txt Adds font license for bundled JetBrains Mono Nerd Font.
components/monitors/cu_bevymon/assets/README.md Documents bundled font set and provenance.
components/monitors/cu_bevymon/README.md Documents crate intent, integration pattern, and focus/input model.
components/monitors/cu_bevymon/Cargo.toml New monitor crate dependencies (bevy_ratatui, soft_ratatui, cu-tuimon, etc.).
components/libs/cu_tuimon/src/ui.rs New shared Ratatui UI implementation + event model (keys/mouse/scroll).
components/libs/cu_tuimon/src/tui_nodes/node.rs Vendored tui-nodes node layout primitive.
components/libs/cu_tuimon/src/tui_nodes/mod.rs Vendored tui-nodes module wiring + exports.
components/libs/cu_tuimon/src/tui_nodes/graph.rs Vendored + adapted node graph layout/rendering.
components/libs/cu_tuimon/src/tui_nodes/connection.rs Vendored connection routing/rendering implementation.
components/libs/cu_tuimon/src/tui_nodes/LICENSE MIT license for vendored tui-nodes code.
components/libs/cu_tuimon/src/model.rs New shared monitor model (stats/status/pools/copperlist + optional logs).
components/libs/cu_tuimon/src/logpane.rs New shared live log + optional stderr capture pipeline.
components/libs/cu_tuimon/src/lib.rs New library crate root + public exports.
components/libs/cu_tuimon/README.md Documents cu_tuimon role, APIs, and consumers.
components/libs/cu_tuimon/Cargo.toml New crate manifest + feature flags for log pane and stderr capture.
Cargo.toml Adds new workspace members and workspace dep bevy_ratatui.
AGENTS.md Adds Rust clippy-related guidance (casts + .is_multiple_of).
.github/actions/rust-ci-setup/action.yml Installs libasound2-dev for CI builds needing audio deps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/monitors/cu_bevymon/assets/README.md Outdated
Comment on lines +57 to +76
fn new(target: CaptureTarget, capture_stderr: bool) -> Self {
#[cfg(debug_assertions)]
register_live_log_listener({
let target = target.clone();
move |entry, format_str, param_names| {
target.handle_structured_log(entry, format_str, param_names);
}
});

Self {
target,
#[cfg(debug_assertions)]
registered_live_listener: true,
#[cfg(feature = "stderr_capture")]
stderr_redirect: if capture_stderr {
BufferRedirect::stderr().ok()
} else {
None
},
}

Copilot AI Mar 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MonitorLogCapture::new sets registered_live_listener: true unconditionally, but cu29_log_runtime::register_live_log_listener is a no-op until the logger runtime is initialized. If LOGGER_STATE isn’t set yet, this instance won’t actually register, but Drop will still call unregister_live_log_listener() later and can inadvertently clear another listener registered after initialization. Consider setting registered_live_listener based on LOGGER_STATE.get().is_some() at construction time, or making registration return a boolean so Drop only unregisters when it truly registered.

Copilot uses AI. Check for mistakes.
Comment thread components/monitors/cu_bevymon/src/lib.rs Outdated
gbin and others added 2 commits March 7, 2026 15:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gbin gbin merged commit 1367ede into master Mar 7, 2026
23 checks passed
@gbin gbin deleted the gbin/bevy_monitor branch March 7, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants