Documentation
¶
Overview ¶
Package tui style tokens: single source of truth for visual language. Direction: cool chrome, warm content — colour alone distinguishes UI from output.
Package tui theme: single source of truth for colour. v2 has no AdaptiveColor; palette is resolved once from background.
Index ¶
- Constants
- func NewCommandPalette(specs []agent.CommandSpec, width, height int) list.Model
- func NewModelPicker(items []list.Item, width, height int) list.Model
- func NewSessionPicker(items []list.Item, width, height int) list.Model
- func Run(ctx context.Context, registry *provider.Registry, session *agent.Session, ...) error
- type ApprovalBridge
- type ApprovalRequest
- type ChatMessage
- type ChatRole
- type Model
- type ModelItem
- type MotionSettings
- type SessionItem
Constants ¶
const ( MotionAuto = "auto" MotionReduced = "reduced" MotionOff = "off" )
Motion settings accepted by tui motion.
Variables ¶
This section is empty.
Functions ¶
func NewCommandPalette ¶ added in v0.7.5
func NewCommandPalette(specs []agent.CommandSpec, width, height int) list.Model
NewCommandPalette builds the Ctrl+K overlay: a fuzzy list over the same registry dispatch and /help read.
func NewModelPicker ¶ added in v0.2.0
Caller frames with modalOverlayStyle, so no border here.
func NewSessionPicker ¶ added in v0.7.5
NewSessionPicker builds the /sessions overlay. Same list mechanics as the model picker, so filtering and cursor keys behave identically.
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, maxContextTokens int, autoCompact bool, keepRecentTokens int, plan *tools.PlanStore, scratchpad *tools.ScratchpadStore, verifyCommand string, verifyTimeout time.Duration, motion MotionSettings, ) error
Run starts the Bubble Tea interface; agent behaviour lives in agent.AgentLoop.
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)
RequestApproval is the legacy yes/no request. Grant and read-only choices still approve the pending call; only the additional scope is dropped.
func (*ApprovalBridge) RequestApprovalChoice ¶ added in v0.7.4
func (b *ApprovalBridge) RequestApprovalChoice(toolName string, args json.RawMessage, preview string) (tools.ApprovalChoice, error)
RequestApprovalChoice asks the TUI for a full decision. The gate installs this as OnPresentChoice so grants and the per-turn read-only flag can be expressed from the modal.
Limitation: the TUI has no argument editor, so ApprovalChoice.ApprovalEdit is never produced here. The plain loop wires tools.ApprovalGate.EditArgs; the TUI deliberately offers only y/a/r/n to avoid claiming parity.
type ApprovalRequest ¶
type ApprovalRequest struct {
ToolName string
Args json.RawMessage
Preview string
// ReplyCh carries the legacy yes/no answer. It is nil when the requester
// made a choice-aware request.
ReplyCh chan bool
// ChoiceCh carries the full decision for choice-aware requesters.
ChoiceCh chan tools.ApprovalChoice
}
type ChatMessage ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func NewModel ¶
func NewModel(providerName, modelName, version, workspaceRoot string, bridge *ApprovalBridge, inputCh chan string, steerCh chan string, outputCh chan tea.Msg, cancelCh chan struct{}, pickerItems []list.Item, motion MotionSettings) Model
type ModelItem ¶ added in v0.2.0
ModelItem is a selectable model in the fuzzy picker.
func (ModelItem) Description ¶ added in v0.2.0
func (ModelItem) FilterValue ¶ added in v0.2.0
type MotionSettings ¶ added in v0.7.5
type MotionSettings struct {
// Mode is "auto", "reduced" or "off"; empty behaves as "auto".
Mode string
// SmoothStreaming paces streamed text and tool-argument previews into the
// transcript instead of appending raw provider bursts.
SmoothStreaming bool
}
MotionSettings is the tui animation configuration handed to the UI.
type SessionItem ¶ added in v0.7.5
type SessionItem struct {
ID string
Excerpt string
Provider string
Model string
UpdatedAt time.Time
Messages int
}
SessionItem is one resumable session in the session picker. The full ID is what /resume receives; the row shows the generated suffix plus the same fields the text listing prints (title, updated time, message count), so the picker and `/sessions` describe a session the same way. The stored title is an excerpt of the first user message; Excerpt avoids colliding with the list.Item Title() method.
func (SessionItem) Description ¶ added in v0.7.5
func (s SessionItem) Description() string
func (SessionItem) FilterValue ¶ added in v0.7.5
func (s SessionItem) FilterValue() string
FilterValue includes the whole ID so a user who knows it can paste it into the filter instead of scrolling.
func (SessionItem) Title ¶ added in v0.7.5
func (s SessionItem) Title() string