bubbletea

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package bubbletea is evva's reference terminal UI: it satisfies the public ui.UI contract (pkg/ui) and drives any agent through ui.Controller, so it depends only on pkg/* — a downstream host embeds it exactly the way cmd/evva does. Built from focused components, a focus stack, and a declarative layout engine rather than a god-object root model.

Wiring (host responsibility):

tui := bubbletea.New(evvaHome)
ag, _ := agent.New(agent.Config{...}, agent.WithSink(tui), agent.WithRootContext(ctx))
tui.Attach(ag.Controller())
tui.Run(ctx)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UI

type UI struct {
	// contains filtered or unexported fields
}

UI is the v2 bubbletea TUI. Construct with New(); attach an agent via Attach() before calling Run().

func New

func New(evvaHome string) *UI

New builds a UI ready to be Attached and Run. evvaHome is the user's config directory (typically ~/.evva); it is plumbed through to the app model for future banner / settings resolution.

Mouse capture is on via tea.WithMouseCellMotion so the wheel scrolls the transcript viewport. The trade-off (no native drag-select unless the user holds Shift/Alt) is documented in the approved plan; the Ctrl+Y yank mode is the canonical clean-copy path for users on terminals where Shift-bypass doesn't work (tmux, screen).

func (*UI) Attach

func (u *UI) Attach(c ui.Controller)

Attach hands the UI its agent controller. Must be called before Run.

func (*UI) Emit

func (u *UI) Emit(e event.Event)

Emit satisfies event.Sink — by queueing, never by calling Send inline.

Program.Send blocks whenever the receive loop is busy or not yet running (p.msgs is unbuffered), and emitters may hold locks the Update/View path reads back: the workflow engine's dispatch sweep emits daemon/board changes while holding the engine mutex that the daemon strips' per-frame Snapshot pull acquires. An inline Send turned that into a mutual wait that froze the whole TUI — the runtime sibling of the pre-Run startup deadlock this method used to buffer around. The EmitQueue's pump goroutine owns the only blocking Send.

func (*UI) Run

func (u *UI) Run(ctx context.Context) error

Run starts the bubbletea program and blocks until exit. ctx cancellation triggers a clean shutdown via a QuitMsg.

The emit pump starts here: events queued since construction flush first (the documented wiring constructs the agent before Run, and agent construction emits — the workflow board's SetSession notify does). The pump's first Send simply blocks until the receive loop is live, and program teardown cancels the program context, so a Send in flight at exit returns instead of wedging the pump.

Directories

Path Synopsis
Package app is the v2 TUI's top-level tea.Model.
Package app is the v2 TUI's top-level tea.Model.
components
agents
Package agents renders the horizontal subagent chip strip that sits just above the input.
Package agents renders the horizontal subagent chip strip that sits just above the input.
bgtasks
Package bgtasks renders the horizontal background-task chip strip.
Package bgtasks renders the horizontal background-task chip strip.
diff
Package diff renders a *fs.FileDiff (the structured metadata write_file / edit_file attach to tools.Result) as a multi-line git-style string with a gutter / content split.
Package diff renders a *fs.FileDiff (the structured metadata write_file / edit_file attach to tools.Result) as a multi-line git-style string with a gutter / content split.
input
Package input owns the v2 TUI's bottom textarea: prompt composition, paste compaction, and history navigation.
Package input owns the v2 TUI's bottom textarea: prompt composition, paste compaction, and history navigation.
monitors
Package monitors renders the horizontal monitor-task chip strip.
Package monitors renders the horizontal monitor-task chip strip.
overlays
Package overlays implements the modal panels the App pushes onto its focus stack: /config (form), /model (picker), /compact (chooser).
Package overlays implements the modal panels the App pushes onto its focus stack: /config (form), /model (picker), /compact (chooser).
slash
Package slash renders the autocomplete suggestion panel that pops up when the user types "/" at the start of the input.
Package slash renders the autocomplete suggestion panel that pops up when the user types "/" at the start of the input.
status
Package status owns the v2 TUI's bottom HUD: the run-state pill, model + token cells, context-utilization meter, and the contextual hint line that sits above it.
Package status owns the v2 TUI's bottom HUD: the run-state pill, model + token cells, context-utilization meter, and the contextual hint line that sits above it.
todos
Package todos renders the bottom todo panel and the green "TODOS COMPLETE" snapshot folded into the transcript when every todo in the store finishes.
Package todos renders the bottom todo panel and the green "TODOS COMPLETE" snapshot folded into the transcript when every todo in the store finishes.
transcript
Package transcript owns the scrollback model of the v2 TUI.
Package transcript owns the scrollback model of the v2 TUI.
workflow
Package workflow renders the dynamic-workflow board panel — the solo counterpart of the swarm web board: one row per task with lifecycle glyph, dependency badges, verify-policy chip, and a live spinner for tasks whose worker daemon is currently running.
Package workflow renders the dynamic-workflow board panel — the solo counterpart of the swarm web board: one row per task with lifecycle glyph, dependency badges, verify-policy chip, and a live spinner for tasks whose worker daemon is currently running.
Package events declares the tea.Msg types the v2 TUI passes through its Update loop.
Package events declares the tea.Msg types the v2 TUI passes through its Update loop.
Package mouse owns mouse-capture wiring + clipboard integration.
Package mouse owns mouse-capture wiring + clipboard integration.
Package theme owns every styled surface in the v2 TUI.
Package theme owns every styled surface in the v2 TUI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL