tui

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tui style tokens.

This file is the single source of truth for the TUI's visual language. The rules it enforces:

  • Colour lives here and nowhere else. If a hue is needed twice it gets a name; call sites never write hex. That is what stops the palette drifting into a dozen near-identical blues as the UI grows.
  • Colour is AdaptiveColor everywhere, because a TUI is not assumed to run on a dark terminal. Light values are darkened, not merely lightened, so that text keeps contrast against a white background instead of glowing.
  • Every colour is a role, not a pigment. Asking "what job does this do?" is what keeps the ramp small enough to reason about.

Direction: cool chrome, warm content. Surfaces, borders and interactive elements are azure/slate; anything the agent *did* (tool output, approvals, errors) is amber/red. That way a glance at colour alone tells you whether you are looking at UI or at output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModelPicker added in v0.2.0

func NewModelPicker(items []list.Item, width, height int) list.Model

NewModelPicker creates and configures the bubbles/list model picker.

The picker is framed by modalOverlayStyle by its caller, so it draws no border of its own and stays quiet until the cursor moves onto a row.

func Run

func Run(
	ctx context.Context,
	registry *provider.Registry,
	session *agent.Session,
	toolRegistry *tools.Registry,
	approval *tools.ApprovalGate,
	version string,
	workspaceRoot string,
	guardCfg agent.LoopGuardConfig,
) error

Run starts the Bubble Tea interface over the shared agent engine.

All agent behaviour — streaming, tool execution, approval, context truncation and the loop guard — lives in agent.AgentLoop. This file only translates engine events into tea messages and routes user input back in.

Types

type ApprovalBridge

type ApprovalBridge struct {
	RequestCh chan ApprovalRequest
}

func NewApprovalBridge

func NewApprovalBridge() *ApprovalBridge

func (*ApprovalBridge) RequestApproval

func (b *ApprovalBridge) RequestApproval(toolName string, args json.RawMessage, preview string) (bool, error)

type ApprovalRequest

type ApprovalRequest struct {
	ToolName string
	Args     json.RawMessage
	Preview  string
	ReplyCh  chan bool
}

type ChatMessage

type ChatMessage struct {
	Role    ChatRole
	Label   string
	Content string
}

type ChatRole

type ChatRole int
const (
	RoleUser ChatRole = iota
	RoleAssistant
	RoleTool
	RoleSystem
	RoleError
)

type Model

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

func NewModel

func NewModel(providerName, modelName, version, workspaceRoot string, bridge *ApprovalBridge, inputCh chan string, outputCh chan tea.Msg, cancelCh chan struct{}, pickerItems []list.Item) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type ModelItem added in v0.2.0

type ModelItem struct {
	Provider string
	Model    string
}

ModelItem represents a selectable model item in the fuzzy picker.

func (ModelItem) Description added in v0.2.0

func (i ModelItem) Description() string

func (ModelItem) FilterValue added in v0.2.0

func (i ModelItem) FilterValue() string

func (ModelItem) Title added in v0.2.0

func (i ModelItem) Title() string

Jump to

Keyboard shortcuts

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