Skip to content

re-use terminal manager#12964

Draft
harryalbert wants to merge 26 commits into
graphite-base/12964from
harry/share-terminal-prototype
Draft

re-use terminal manager#12964
harryalbert wants to merge 26 commits into
graphite-base/12964from
harry/share-terminal-prototype

Conversation

@harryalbert

Copy link
Copy Markdown
Contributor

Description

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

kevinyang372 and others added 23 commits June 23, 2026 12:00
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>
@cla-bot cla-bot Bot added the cla-signed label Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@harryalbert harryalbert mentioned this pull request Jun 23, 2026
4 tasks
Comment thread app/src/terminal/local_tty/terminal_manager.rs
@harryalbert harryalbert force-pushed the harry/share-terminal-prototype branch from d042452 to dfdbde9 Compare June 23, 2026 22:00
Comment thread app/src/pane_group/mod.rs Outdated
/// 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>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is part of the trait?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

discussed offline

@harryalbert harryalbert force-pushed the harry/share-terminal-model branch from 4fde9c0 to 7fd6fa0 Compare June 24, 2026 00:24
@harryalbert harryalbert changed the base branch from harry/share-terminal-model to graphite-base/12964 June 24, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants