Skip to content

Add TUI API surface to AppContext under tui#12633

Merged
zachbai merged 3 commits into
masterfrom
zb/tui-backend/03a-tui-seam
Jun 19, 2026
Merged

Add TUI API surface to AppContext under tui#12633
zachbai merged 3 commits into
masterfrom
zb/tui-backend/03a-tui-seam

Conversation

@zachbai

@zachbai zachbai commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

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" StoredViewenum which delegates toAnyView/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

  • cargo check -p warpui_core -p warp -p warpui clean in both default and --features tui.
  • cargo nextest -p warpui_core: 286/7 (default), 311/7 (--features tui).

Agent Mode

  • Warp Agent Mode

CHANGELOG-NONE

zachbai commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12633 June 15, 2026 07:25
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from e30ebf4 to f85df3c Compare June 15, 2026 07:25
@zachbai zachbai force-pushed the graphite-base/12633 branch from 7eb80a2 to cb839d6 Compare June 15, 2026 07:25
@zachbai zachbai changed the base branch from graphite-base/12633 to zb/tui-backend/02-tui-view-layer June 15, 2026 07:25
@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12633 June 15, 2026 19:58
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from f85df3c to f02f2af Compare June 15, 2026 19:58
@zachbai zachbai force-pushed the graphite-base/12633 branch from cb839d6 to 68de666 Compare June 15, 2026 19:58
@zachbai zachbai changed the base branch from graphite-base/12633 to zb/tui-backend/02-tui-view-layer June 15, 2026 19:58
@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12633 June 15, 2026 21:44
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from f02f2af to 73c3649 Compare June 15, 2026 21:45
@zachbai zachbai force-pushed the graphite-base/12633 branch from 68de666 to daa83ce Compare June 15, 2026 21:45
@zachbai zachbai changed the base branch from graphite-base/12633 to zb/tui-backend/02-tui-view-layer June 15, 2026 21:45
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 73c3649 to c459ffb Compare June 15, 2026 22:42
@zachbai zachbai force-pushed the zb/tui-backend/02-tui-view-layer branch from daa83ce to 21e266f Compare June 15, 2026 22:42
@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12633 June 15, 2026 22:50
@zachbai zachbai force-pushed the graphite-base/12633 branch from 21e266f to 2f3a0e9 Compare June 15, 2026 22:51
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from c459ffb to 878719b Compare June 15, 2026 22:51
@zachbai zachbai changed the base branch from graphite-base/12633 to zb/tui-backend/02-tui-view-layer June 15, 2026 22:51
@zachbai zachbai changed the base branch from zb/tui-backend/02-tui-view-layer to graphite-base/12633 June 15, 2026 23:59
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 878719b to b0ddbff Compare June 15, 2026 23:59
@zachbai zachbai force-pushed the graphite-base/12633 branch from 2f3a0e9 to a2e8bfc Compare June 15, 2026 23:59
@zachbai zachbai changed the base branch from graphite-base/12633 to zb/tui-backend/02-tui-view-layer June 15, 2026 23:59
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from b0ddbff to 4d98812 Compare June 16, 2026 21:02
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch 2 times, most recently from 4cfc5f6 to 898f32e Compare June 17, 2026 23:21
@zachbai zachbai changed the title warpui_core: in-core TUI seam + element trait and primitives behind the additive tui feature Add TUI API surface to AppContext under tui Jun 17, 2026
@zachbai zachbai marked this pull request as ready for review June 18, 2026 00:24
@zachbai zachbai requested a review from vorporeal June 18, 2026 00:24
@oz-for-oss

oz-for-oss Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@zachbai

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

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>
Base automatically changed from zb/tui-backend/02-tui-view-layer to master June 18, 2026 00:26
zachbai and others added 2 commits June 17, 2026 17:26
…he additive tui feature

Adds the shared-registry seam for a TuiView (StoredView::Tui in window.rs,
TuiView/AnyTuiView, the AppContext add_tui_* / render_tui_view helpers, and the
ViewContext add_tui_view hooks), the TuiElement trait + TuiEmpty +
TuiPresentationContext, and the primitive submodules (geometry, buffer, event).
Relaxes the shared view bounds (View -> Entity/'static), splits the unbounded
ViewHandle accessors, and hoists the shared invalidation helper so a second view
trait can flow through the existing paths. The tui cargo feature and its
crossterm/unicode-* optional deps relocate here from the foundation.

Runtime-drained event.rs methods/fields and TuiPresentationContext::new carry a
scoped #[allow(dead_code)] (removed in the runtime slice).

Co-Authored-By: Oz <oz-agent@warp.dev>
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 5712979 to 54d124c Compare June 18, 2026 00:26

@oz-for-oss oz-for-oss Bot 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.

Overview

This PR adds a feature-gated TUI API surface in warpui_core, including TUI view storage/rendering hooks, shared StoredView dispatch paths, TUI event/presentation context types, terminal-cell geometry and buffer primitives, and tests for the additive TUI behavior.

Concerns

  • No blocking correctness, security, or spec-drift concerns found in the annotated diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@vorporeal vorporeal 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.

yeah sure seems fine, and if it isn't, you'll ask me to approve another PR :P

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.

one high-level question: do we want the Tui prefix everywhere? can we drop it, and in contexts where we're referencing gui and tui variants of the same type, use tui::MyType and gui::MyType partially-qualified names?

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.

I don't think it particularly matters all that much, except that without the prefix, there might be inconsistent qualifying, and in any case where it is not partially qualified it will take a scroll (or a file read tool call to look at the use statement) to disambiguate, and other than aesthetics I don't think really much of an advantage

origin_view_id: Option<EntityId>,
}

#[allow(dead_code)]

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.

why the #[allow(dead_code)]? transient due to it being dead until some future PR in the stack? if so, prefer using expect(dead_code) instead of allow(dead_code), as then you'll get a compilation error when it's no longer dead, and remove it (so it doesn't become stale).

not blocking; goal is more to share the gospel of expect() vs. allow() than to ask for changes :)

/// nothing — only container/child-view elements override this).
/// - [`dispatch_event`](TuiElement::dispatch_event): offer an event to this
/// element, returning whether it was handled (default: not handled).
pub trait TuiElement {

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.

I think the actual shape of this interface is definitely subject to churn

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.

I don't think it particularly matters all that much, except that without the prefix, there might be inconsistent qualifying, and in any case where it is not partially qualified it will take a scroll (or a file read tool call to look at the use statement) to disambiguate, and other than aesthetics I don't think really much of an advantage

@zachbai zachbai merged commit 1ef980b into master Jun 19, 2026
28 checks passed
@zachbai zachbai deleted the zb/tui-backend/03a-tui-seam branch June 19, 2026 23:56
@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.

2 participants