Skip to content

warpui_core: TUI presenter, runtime (crossterm), and end-to-end integration#12601

Draft
zachbai wants to merge 1 commit into
zb/tui-backend/03b-tui-elementsfrom
zb/tui-backend/03-tui-in-core
Draft

warpui_core: TUI presenter, runtime (crossterm), and end-to-end integration#12601
zachbai wants to merge 1 commit into
zb/tui-backend/03b-tui-elementsfrom
zb/tui-backend/03-tui-in-core

Conversation

@zachbai

@zachbai zachbai commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Description

Final PR in the stack: wires the TUI elements (#12634) into a working backend. Behind the tui feature; default builds are unaffected.

  • TUI presenter (presenter/tui.rs): an immediate-mode render pass that lays out the TuiElement tree and feeds the shared view hierarchy via report_view_embeddings (the map introduced in warpui_core: backend-neutral view hierarchy for a shared responder chain #12413) — so focus and action dispatch work identically to GUI.
  • Runtime (runtime/*): a crossterm renderer plus terminal-event → warpui event conversion, driving redraws through the same window_invalidations the GUI uses.
  • crossterm added as an optional dependency, gated on tui.
  • End-to-end integration test (tests/tui_integration.rs) exercising the full stack.

Design note: TUI rendering is intentionally immediate-mode and does not adopt the GUI's two-phase scene cache — the two render paths stay divergent by design.

Reviewing: start at presenter/tui.rs (render pass + embedding wiring), then runtime/ (crossterm renderer + event conversion). Everything is tui-gated.

Stack

#12413#12633#12634#12601 (this)

Testing

  • cargo check -p warpui_core -p warp -p warpui clean in both default and --features tui.
  • cargo nextest -p warpui_core --features tui: 365/7; integration test passes.

Agent Mode

  • Warp Agent Mode

CHANGELOG-NONE

zachbai commented Jun 13, 2026

Copy link
Copy Markdown
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.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch 4 times, most recently from 97dfb64 to a394966 Compare June 15, 2026 02:23
@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12601 June 15, 2026 03:57
@zachbai zachbai force-pushed the graphite-base/12601 branch from 0a1c519 to a096d97 Compare June 15, 2026 03:57
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from a394966 to bfdb43e Compare June 15, 2026 03:57
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 15, 2026 03:57
@zachbai zachbai changed the title warpui_core: in-core TUI backend behind the additive tui feature warpui_core: TUI presenter, runtime (crossterm), and end-to-end integration Jun 15, 2026
@zachbai zachbai changed the base branch from zb/tui-backend/03b-tui-elements to graphite-base/12601 June 15, 2026 07:25
@zachbai zachbai force-pushed the graphite-base/12601 branch from a096d97 to d2989fd Compare June 15, 2026 07:25
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from bfdb43e to 5ff450f Compare June 15, 2026 07:25
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 15, 2026 07:25
@zachbai zachbai changed the base branch from zb/tui-backend/03b-tui-elements to graphite-base/12601 June 15, 2026 19:59
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from 5ff450f to e56a95a Compare June 15, 2026 19:59
@zachbai zachbai force-pushed the graphite-base/12601 branch from d2989fd to 33719f7 Compare June 15, 2026 19:59
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 15, 2026 19:59
@zachbai zachbai changed the base branch from zb/tui-backend/03b-tui-elements to graphite-base/12601 June 15, 2026 21:45
@zachbai zachbai force-pushed the graphite-base/12601 branch from 33719f7 to dbe7255 Compare June 15, 2026 21:45
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from e56a95a to c21f89c Compare June 15, 2026 21:45
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 15, 2026 21:45
@zachbai zachbai force-pushed the graphite-base/12601 branch from 7402b63 to 2b8f634 Compare June 15, 2026 22:51
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from 563dbc6 to f9b1d70 Compare June 15, 2026 22:51
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 15, 2026 22:51
@zachbai zachbai changed the base branch from zb/tui-backend/03b-tui-elements to graphite-base/12601 June 15, 2026 23:59
@zachbai zachbai force-pushed the graphite-base/12601 branch from 2b8f634 to 6f914f0 Compare June 16, 2026 00:00
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from f9b1d70 to 4554c48 Compare June 16, 2026 00:00
@zachbai zachbai changed the base branch from graphite-base/12601 to zb/tui-backend/03b-tui-elements June 16, 2026 00:00
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from 4554c48 to b3281f9 Compare June 16, 2026 21:02
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 6f914f0 to 8f0d783 Compare June 16, 2026 21:02
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 8f0d783 to 14b05a4 Compare June 17, 2026 23:04
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch 2 times, most recently from 1cbe74f to f17adcd Compare June 17, 2026 23:21
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 14b05a4 to 0dbf678 Compare June 17, 2026 23:21
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from f17adcd to 8521248 Compare June 17, 2026 23:59
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 0dbf678 to 53736a1 Compare June 17, 2026 23:59
zachbai added a commit that referenced this pull request Jun 18, 2026
…ain (#12413)

## Description
First PR in a stack that adds an optional TUI backend to `warpui`. This
PR is **only** the backend-neutral groundwork — no TUI code, no
behavioral change.

Today the view responder chain (focus/blur, action dispatch, ancestor
walks) is derived from the **GUI presenter's** layout-time parent map.
This PR moves that ownership into `AppContext` so any backend can drive
it:

- New `AppContext.view_parents` — a per-window child→parent view map.
- Fed from two sources: creation-time structural parentage
(`record_view_parent`) and the active backend's render pass
(`report_view_embeddings`).
- Walked by `view_ancestors` / `view_parent_map`; all responder-chain /
focus / dispatch sites now read this map instead of
`presenter.ancestors()`.
- The GUI presenter is updated to feed `report_view_embeddings`, so GUI
behavior is unchanged.

This is a behavior-preserving, GUI-only refactor. The TUI presenter
feeds the same map later in the stack (#12601).

**Reviewing (3 files):** `app.rs` is the substance — the map, its
accessors, and the call-site swaps. `presenter.rs` wires the GUI render
pass to report embeddings. The test swaps `presenter.ancestors()` →
`ctx.view_ancestors()`.

## Stack
`master` → **#12413 (this)** → #12633#12634#12601

## Testing
- [x] `cargo check -p warpui_core -p warp -p warpui` clean; `cargo
nextest -p warpui_core` 279 passed / 7 skipped.
- No manual run: no behavioral change.

## Agent Mode
- [x] Warp Agent Mode

CHANGELOG-NONE

---------

Co-authored-by: Oz <oz-agent@warp.dev>
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from 8521248 to d2ddc72 Compare June 18, 2026 00:26
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 53736a1 to eaa0508 Compare June 18, 2026 00:26
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from d2ddc72 to ab42c95 Compare June 18, 2026 00:53
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from eaa0508 to 01cd3c6 Compare June 18, 2026 00:53
@kevinyang372 kevinyang372 mentioned this pull request Jun 18, 2026
4 tasks
zachbai added a commit that referenced this pull request Jun 19, 2026
## Description

* Add `tui` cargo feature flag
* Add `TuiElement` interface which diverges from gui `Element` 
* Add TUI-specific mirrors of `View` traits and APIs; these depend on
`TuiElement`
* Abstract out `AnyView to wrapper "router" `StoredView` enum which
delegates to `AnyView`/`AnyTuiView` wrapper
* Implement initial `Tui` presenter types - event context, presentation
context
* Move all existing GUI elements to re-exported GUI submodule of
elements

## Stack
#12413 → **#12633 (this)** → #12634#12601

## Testing
- [x] `cargo check -p warpui_core -p warp -p warpui` clean in **both**
default and `--features tui`.
- [x] `cargo nextest -p warpui_core`: 286/7 (default), 311/7
(`--features tui`).

## Agent Mode
- [x] Warp Agent Mode

CHANGELOG-NONE

---------

Co-authored-by: Oz <oz-agent@warp.dev>
…ration

Adds the TUI presenter (presenter/tui.rs: lays out and paints a root element
tree and reports view embeddings into the neutral view hierarchy) and the
crossterm runtime (runtime/: the alternate-screen draw+event loop, renderer, and
crossterm -> warp event conversion), dispatching typed actions through the shared
responder chain. Drops the scoped #[allow(dead_code)] from the seam slice now
that the runtime drains those event.rs methods/fields and constructs
TuiPresentationContext. Includes the end-to-end tui_integration test.

Co-Authored-By: Oz <oz-agent@warp.dev>
@zachbai zachbai force-pushed the zb/tui-backend/03-tui-in-core branch from ab42c95 to 5818929 Compare June 19, 2026 23:57
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 01cd3c6 to a09fa6e Compare June 19, 2026 23:57
@harryalbert harryalbert mentioned this pull request Jun 20, 2026
4 tasks
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.

1 participant