> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openagents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WGPUI

> GPU-accelerated UI system for OpenAgents desktop and web surfaces.

## Overview

WGPUI is the GPU-accelerated UI rendering library used across OpenAgents.
It provides a cross-platform rendering stack built on `wgpu`, a component
system, a layout engine, and testing utilities for high-performance UI
surfaces (chat threads, tool call cards, streaming markdown, etc).

WGPUI is **inspired by GPUI** (the GPU-accelerated UI framework built for
the Zed editor) and borrows the same entity-driven, render-tree approach to
building immediate-mode views on top of a retained state model.

[Effuse](effuse) is the Effect-native TypeScript UI stack used by the Autopilot
Web MVP. The former desktop stack (Tauri + Effuse) has been removed; WGPUI is
the canonical UI layer for Autopilot Desktop.

## Where it lives in the repo

* `crates/wgpui/` - core GPU UI library (renderer, layout, components, testing)
* `crates/autopilot_ui/` - shared WGPUI surfaces for Autopilot
* `crates/autopilot_app/` - app core consumed by both CLI and desktop
* `apps/autopilot-desktop/` - native desktop shell using WGPUI + winit
* Examples and demos:
  * `crates/wgpui/examples/storybook/`
  * `crates/wgpui/examples/component_showcase.rs`
  * `crates/wgpui/examples/first_light.rs`

## Core architecture

WGPUI is organized around an entity-driven UI model and an element tree
pipeline:

* **App + Entity system**: typed state containers and reactive notifications
  (`crates/wgpui/src/app/*`).
* **Element tree**: layout, prepaint, and paint phases for UI elements
  (`crates/wgpui/src/element/*`).
* **Scene**: accumulated draw commands (quads, text runs, images, lines).
* **Renderer**: wgpu pipelines, GPU buffers, and shaders
  (`crates/wgpui/src/renderer.rs` and `crates/wgpui/src/shaders/*`).
* **Layout**: Taffy-based flexbox layout engine
  (`crates/wgpui/src/layout.rs`).
* **Text**: cosmic-text shaping and glyph atlas
  (`crates/wgpui/src/text.rs`, `crates/wgpui/src/text_system/*`).
* **Input + actions**: platform-agnostic events and a keymap/action system
  (`crates/wgpui/src/input.rs`, `crates/wgpui/src/action/*`, `crates/wgpui/src/keymap/*`).

For a full reference, see `crates/wgpui/docs/README.md` and
`crates/wgpui/docs/phase1-foundation.md` in the OpenAgents repo.

## Component system

WGPUI ships a rich UI kit organized by level:

* **Atoms**: badges, indicators, icons, status pills, etc.
* **Molecules**: cards, rows, headers, input clusters.
* **Organisms**: complex UI blocks like tool call cards and message rows.
* **Sections**: higher-order panes like thread views and editors.
* **HUD**: overlays, command palette, status bars, modals.

Core components include `Div`, `Text`, `Button`, `TextInput`, `ScrollView`,
`VirtualList`, `Modal`, `Dropdown`, and `Tabs`
(`crates/wgpui/src/components/*`).

## Platform support

* **Desktop**: `winit` + native wgpu swapchain.
* **Web**: `wasm-bindgen` + WebGPU.

The platform abstraction is in `crates/wgpui/src/platform.rs`.

## Testing

WGPUI includes a dedicated test harness and snapshot tooling in
`crates/wgpui/src/testing/`. This is the foundation for UI regression
tests and layout inspection in the WGPUI migration plan.

## Autopilot Desktop (WGPU)

The native WGPU desktop app lives in:

* `apps/autopilot-desktop/src/main.rs`

That entrypoint wires:

* `autopilot_app` (core app state and event flow)
* `autopilot_ui::MinimalRoot` (WGPUI view root)
* WGPUI renderer + text system
* `winit` event loop and window lifecycle

This is the canonical path for the desktop UI going forward.

## Migration status

See `apps/autopilot-desktop/docs/migration/EFFUSE_TO_WGPUI_PLAN.md` in the
OpenAgents repo for the full migration plan and architectural decisions.
