Skip to main content

Crate gpui_ai

Crate gpui_ai 

Source
Expand description

AI-native UI components for GPUI applications.

Composed, opinionated components for the surfaces an AI application keeps rebuilding — streaming text, thinking traces, tool calls, approval gates — built on [gpui_component] and inheriting its semantic-token theming. Every component resolves all of its presentation through the active theme, so light/dark modes, bundled themes, and custom JSON themes work without extra wiring.

§Design rules

  • Stateless components are fluent [gpui::RenderOnce] builders; stateful composites are entities. Callbacks use on_* methods.
  • Progressive output flows through one model: stream::StreamedContent. Components render snapshots; applications own the state and the clock.
  • No component runs a clock over the state it is given, or keeps fixture data. A component may time something it alone owns — a “Copied” confirmation clearing itself — but nothing a snapshot describes is ever advanced from inside.

Further components land phase by phase; see the repository roadmap.

Modules§

approval
Human-in-the-loop approval gates for agent actions.
artifact
Artifact side panel: a generated document, code file, or data view shown beside the conversation.
attachment
Attachment previews: the files a person adds to a prompt and the files a message carries.
chat
Controlled, virtualized chat transcript composed from gpui-ai primitives.
chip
Compact chips representing tool calls and code edits.
code_block
Syntax-highlighted code blocks with streaming reveal.
code_diff
Code diff viewer: a unified patch as reviewable hunks.
command_search
Stable-ID command search composed over gpui-component’s native command palette.
comparison_table
Bounded, feature-oriented comparison table values and presentation.
context_card
Cards for retrieved knowledge chunks with source attribution.
context_meter
Context-window usage: how much of the model’s window a conversation has consumed, as a ring, a bar, or plain text, with a hover breakdown.
cues
Interaction cues: the moments an application may want to mark with a sound, haptic, or notification.
decoration
Layers an application paints into a component’s frame.
diff_table
Controlled before/after proposals for tabular data.
filter_table
Controlled filter-table values and animated stable-row presentation.
fine_tune
Controlled fine-tune inspector for design properties.
form
The controls a person answers with: one choice from a set, and one switch between two states.
image_generation
Progressive reveal for image generation.
insight
Paged analytical insight cards with metrics and a time series.
loading
An animated pixel-grid loading state with optional elapsed time.
motion
Motion primitives shared by gpui-ai components.
orbs
An ambient, always-moving indicator for “the model is alive” moments.
plan
Plan cards: an agent’s proposed steps as one reviewable card.
popup
Where transient surfaces open, how soon, and what edge they draw.
prelude
Convenient single-import surface: use gpui_ai::prelude::*;.
prompt_bar
Hybrid-controlled prompt composition with native GPUI text editing.
question_flow
A short sequence of questions an agent asks before it acts.
queue
Message queue: prompts waiting their turn while the agent is busy.
recommendation
Agent suggestion cards with confidence and alternatives.
records_table
Controlled record-grid values and presentation.
scrolling
Scroll behavior primitives: wheel acceleration and middle-click autoscroll.
search_results
Web-search tool output: a query and its results with sources.
selection_actions
Selection-anchored actions for readable Markdown content.
sidebar_nav
Stable-ID, filterable navigation composed over gpui-component’s Sidebar primitives.
sizing
Semantic size policy: control heights and leading glyph slots.
status
One status vocabulary for every lifecycle the library displays.
stream
Shared lifecycle and revision tracking for progressively arriving content.
streaming_text
Streamed markdown answers with sources and follow-up suggestions.
suggestions
Suggestion chips: starter prompts and follow-ups as one quiet row.
task
Live status rows for progressive agent tasks.
thinking
Expandable progressive reasoning traces.
thread_list
Conversation list: new, switch, rename, archive, delete, and search.
todo_list
Agent plan display: a to-do list with live completion status.
tool_call
Collapsible tool-call cards and the group that folds a burst of them.
voice
Voice controls: dictation and speech as typed intent.

Traits§

ButtonLabelExt
Adds a text label with the theme’s leading rather than a one-em line box.

Functions§

init
Initializes gpui-ai.