re-use terminal manager#12964
Draft
harryalbert wants to merge 26 commits into
Draft
Conversation
Build the immediate-mode presenter and the draw + event runtime on top of the ratatui element layer, completing the in-core TUI backend behind the `tui` feature: - presenter::tui::TuiPresenter: measure -> arrange -> present -> paint into a ratatui Buffer, reporting child-view embeddings into the shared neutral view hierarchy. - runtime::TuiRuntime drives a TuiView window: raw mode + alt screen via a RAII guard, invalidate -> redraw, crossterm input -> shared keymap then element-tree dispatch, draining deferred app updates / typed actions. - TuiFrameRenderer flushes via ratatui's Buffer::diff + CrosstermBackend instead of a hand-rolled diff; crossterm comes from ratatui::crossterm. - event_conversion maps crossterm 0.29 input to the shared Event vocabulary. - Re-export Color/Modifier from elements::tui so consumers can style text without depending on ratatui directly. - tests/tui_integration.rs: end-to-end model -> view -> presenter -> typed action flow against the shared core.
Remove the TUI short-circuit in run_internal so the headless app bootstraps the same singletons as other modes. Guard the terminal-server pty_spawner singleton (None for Tui) so it is only registered when present, skip the GUI-only ActiveSession singleton for Tui, and branch to tui::init after initialize_app instead of entering launch. The GUI path and registration order are otherwise unchanged. Co-Authored-By: Oz <oz-agent@warp.dev>
Pull the view-free, PTY-spawn-free session core out of TerminalManager::create_model into a new build_session_core function returning a SessionCore (channels, Sessions, ModelEventDispatcher, TerminalModel via create_terminal_model, and PtyController). create_model now calls build_session_core for those steps, then continues to build the view, agent cluster, and wiring exactly as before, so GUI behavior and registration order are unchanged. The PTY itself is still spawned later in on_shell_determined (deferred, unchanged); a later phase extracts that spawn into a shared helper the TUI reuses. build_session_core is pub(crate) so the TUI session can call it directly. Co-Authored-By: Oz <oz-agent@warp.dev>
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
harryalbert
commented
Jun 23, 2026
d042452 to
dfdbde9
Compare
| /// default. | ||
| pub(crate) trait TerminalSurface: Entity + Sized + 'static { | ||
| /// Translates a surface event into the PTY intent it should drive, if any. | ||
| fn pty_intent(event: &Self::Event) -> Option<PtySurfaceIntent>; |
Contributor
Author
There was a problem hiding this comment.
discussed offline
4fde9c0 to
7fd6fa0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Linked Issue
ready-to-specorready-to-implement.Testing
./script/runScreenshots / Videos
Agent Mode