Documentation
¶
Index ¶
- func ExpandGlob(pattern string) ([]string, error)
- func ExpandUserPath(path string) (string, error)
- func FormatFileSize(bytes int64) string
- func GetBundledServers() []mcp.BundledServer
- func GetParentOptions(path string) []string
- func SaveApprovedDirs(dirs *ApprovedDirs) error
- type ApprovalRequestMsg
- type ApprovedDirs
- type AskUserRequestMsg
- type Command
- type CommandSource
- type CompletionsModel
- func (c *CompletionsModel) Hide()
- func (c *CompletionsModel) IsVisible() bool
- func (c *CompletionsModel) Selected() *Command
- func (c *CompletionsModel) SetItems(items []Command)
- func (c *CompletionsModel) SetQuery(query string)
- func (c *CompletionsModel) SetSize(width, height int)
- func (c *CompletionsModel) Show()
- func (c *CompletionsModel) Update(msg tea.Msg) (*CompletionsModel, tea.Cmd)
- func (c *CompletionsModel) View() string
- type ContentPos
- type DialogItem
- type DialogModel
- func (d *DialogModel) Close()
- func (d *DialogModel) Content() string
- func (d *DialogModel) Cursor() int
- func (d *DialogModel) GetDirApprovalPath() string
- func (d *DialogModel) IsOpen() bool
- func (d *DialogModel) ItemAt(idx int) *DialogItem
- func (d *DialogModel) Query() string
- func (d *DialogModel) Selected() *DialogItem
- func (d *DialogModel) SetCursor(pos int)
- func (d *DialogModel) SetQuery(query string)
- func (d *DialogModel) SetSize(width, height int)
- func (d *DialogModel) ShowContent(title, content string)
- func (d *DialogModel) ShowDirApproval(filePath string, options []string)
- func (d *DialogModel) ShowMCPPicker(mcpManager *mcp.Manager)
- func (d *DialogModel) ShowModelPicker(currentProviderModel string, providers []ProviderInfo, recentModels []string)
- func (d *DialogModel) ShowSessionList(items []DialogItem, currentSessionID string)
- func (d *DialogModel) Type() DialogType
- func (d *DialogModel) Update(msg tea.Msg) (*DialogModel, tea.Cmd)
- func (d *DialogModel) View() string
- type DialogType
- type DirApprovalRequest
- type FileAttachment
- type FileCompletion
- type FileCompletionSource
- type FlushBeforeApprovalMsg
- type FlushBeforeAskUserMsg
- type HandoverRequestMsg
- type ImageAttachment
- type KeyMap
- type Model
- func (m *Model) ExecuteCommand(input string) (tea.Model, tea.Cmd)
- func (m *Model) Init() tea.Cmd
- func (m *Model) ReloadSessionID() string
- func (m *Model) RequestedHandoverAutoSend() string
- func (m *Model) RequestedResumeSessionID() string
- func (m *Model) SetAgentLister(lister func(cfg *config.Config) ([]string, error))
- func (m *Model) SetAgentResolver(resolver func(name string, cfg *config.Config) (*agents.Agent, error))
- func (m *Model) SetApprovalManager(mgr *tools.ApprovalManager)
- func (m *Model) SetCurrentAgent(agent *agents.Agent)
- func (m *Model) SetFooterWarning(content string)
- func (m *Model) SetHandoverApprovalManager(mgr *tools.ApprovalManager)
- func (m *Model) SetHandoverAutoSend(text string)
- func (m *Model) SetHandoverSystemPromptResolver(...)
- func (m *Model) SetProgram(p *tea.Program)
- func (m *Model) SetRootContext(ctx context.Context)
- func (m *Model) TakePostFrameImageSequence() string
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() tea.View
- func (m *Model) WaitStreamDone()
- func (m *Model) WantsReload() bool
- func (m *Model) YoloModeActive() bool
- type ProviderInfo
- type ResumeFromExternalUIMsg
- type Selection
- type SubagentProgressMsg
- type Subcommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandGlob ¶
ExpandGlob expands a glob pattern to matching files
func ExpandUserPath ¶ added in v0.0.257
ExpandUserPath expands a leading ~ or ~/ in user-provided file paths before globbing, approval checks, or file reads. Shells do not expand ~ inside the TUI command parser, so slash commands need to do it explicitly.
func FormatFileSize ¶
FormatFileSize returns a human-readable file size
func GetBundledServers ¶ added in v0.0.55
func GetBundledServers() []mcp.BundledServer
GetBundledServers returns bundled MCP servers (wrapper for mcp package)
func GetParentOptions ¶
GetParentOptions returns the directory and its parents for approval choices
func SaveApprovedDirs ¶
func SaveApprovedDirs(dirs *ApprovedDirs) error
SaveApprovedDirs saves the approved directories to disk
Types ¶
type ApprovalRequestMsg ¶ added in v0.0.50
type ApprovalRequestMsg struct {
Path string
IsWrite bool
IsShell bool
WorkDir string // directory where a shell command will execute (may be empty)
DoneCh chan<- tools.ApprovalResult
}
ApprovalRequestMsg triggers an inline approval prompt.
type ApprovedDirs ¶
type ApprovedDirs struct {
ApprovedAt time.Time `json:"approved_at"`
Directories []string `json:"directories"`
}
ApprovedDirs stores the list of approved directories
func LoadApprovedDirs ¶
func LoadApprovedDirs() (*ApprovedDirs, error)
LoadApprovedDirs loads the approved directories from disk
func (*ApprovedDirs) AddDirectory ¶
func (d *ApprovedDirs) AddDirectory(dir string) error
AddDirectory adds a directory to the approved list
func (*ApprovedDirs) IsPathApproved ¶
func (d *ApprovedDirs) IsPathApproved(path string) bool
IsPathApproved checks if a path is within an approved directory
func (*ApprovedDirs) RemoveDirectory ¶
func (d *ApprovedDirs) RemoveDirectory(dir string) error
RemoveDirectory removes a directory from the approved list
type AskUserRequestMsg ¶ added in v0.0.50
type AskUserRequestMsg struct {
Questions []tools.AskUserQuestion
DoneCh chan<- []tools.AskUserAnswer
}
AskUserRequestMsg triggers an inline ask_user prompt.
type Command ¶
type Command struct {
Name string
Aliases []string
Description string
Usage string
Subcommands []Subcommand // Optional subcommands
}
Command represents a slash command
func FilterCommands ¶
FilterCommands returns commands matching the query using fuzzy search If query contains a space (e.g., "mcp "), it returns subcommands for that command
type CommandSource ¶
type CommandSource []Command
CommandSource implements fuzzy.Source for command searching
func (CommandSource) Len ¶
func (c CommandSource) Len() int
func (CommandSource) String ¶
func (c CommandSource) String(i int) string
type CompletionsModel ¶
type CompletionsModel struct {
// contains filtered or unexported fields
}
CompletionsModel handles the command completions popup
func NewCompletionsModel ¶
func NewCompletionsModel(styles *ui.Styles) *CompletionsModel
NewCompletionsModel creates a new completions model
func (*CompletionsModel) IsVisible ¶
func (c *CompletionsModel) IsVisible() bool
IsVisible returns whether the popup is visible
func (*CompletionsModel) Selected ¶
func (c *CompletionsModel) Selected() *Command
Selected returns the currently selected command
func (*CompletionsModel) SetItems ¶
func (c *CompletionsModel) SetItems(items []Command)
SetItems sets custom completion items (for dynamic completions like server names)
func (*CompletionsModel) SetQuery ¶
func (c *CompletionsModel) SetQuery(query string)
SetQuery updates the filter query
func (*CompletionsModel) SetSize ¶
func (c *CompletionsModel) SetSize(width, height int)
SetSize updates the dimensions
func (*CompletionsModel) Show ¶
func (c *CompletionsModel) Show()
Show displays the completions popup
func (*CompletionsModel) Update ¶
func (c *CompletionsModel) Update(msg tea.Msg) (*CompletionsModel, tea.Cmd)
Update handles messages
func (*CompletionsModel) View ¶
func (c *CompletionsModel) View() string
View renders the completions popup
type ContentPos ¶ added in v0.0.112
type ContentPos struct {
Line int // 0-based line in full content string
Col int // 0-based visual column
}
ContentPos is a position within the full rendered content.
type DialogItem ¶
DialogItem represents an item in a dialog list
type DialogModel ¶
type DialogModel struct {
// contains filtered or unexported fields
}
DialogModel handles modal dialogs
func NewDialogModel ¶
func NewDialogModel(styles *ui.Styles) *DialogModel
NewDialogModel creates a new dialog model
func (*DialogModel) Content ¶ added in v0.0.224
func (d *DialogModel) Content() string
Content returns the raw content currently displayed by a content dialog.
func (*DialogModel) Cursor ¶
func (d *DialogModel) Cursor() int
Cursor returns the current cursor position
func (*DialogModel) GetDirApprovalPath ¶
func (d *DialogModel) GetDirApprovalPath() string
func (*DialogModel) IsOpen ¶
func (d *DialogModel) IsOpen() bool
IsOpen returns whether a dialog is open
func (*DialogModel) ItemAt ¶
func (d *DialogModel) ItemAt(idx int) *DialogItem
ItemAt returns the item at the given index (0-based)
func (*DialogModel) Query ¶
func (d *DialogModel) Query() string
Query returns the current filter query
func (*DialogModel) Selected ¶
func (d *DialogModel) Selected() *DialogItem
Selected returns the currently highlighted item
func (*DialogModel) SetCursor ¶
func (d *DialogModel) SetCursor(pos int)
SetCursor sets the cursor position, clamping to valid range
func (*DialogModel) SetQuery ¶
func (d *DialogModel) SetQuery(query string)
SetQuery updates the filter query for model picker or MCP picker
func (*DialogModel) SetSize ¶
func (d *DialogModel) SetSize(width, height int)
SetSize updates the dimensions
func (*DialogModel) ShowContent ¶ added in v0.0.224
func (d *DialogModel) ShowContent(title, content string)
ShowContent opens a scrollable static content modal.
func (*DialogModel) ShowDirApproval ¶
func (d *DialogModel) ShowDirApproval(filePath string, options []string)
ShowDirApproval opens the directory approval dialog
func (*DialogModel) ShowMCPPicker ¶
func (d *DialogModel) ShowMCPPicker(mcpManager *mcp.Manager)
ShowMCPPicker opens the MCP server picker dialog
func (*DialogModel) ShowModelPicker ¶
func (d *DialogModel) ShowModelPicker(currentProviderModel string, providers []ProviderInfo, recentModels []string)
ShowModelPicker opens the model picker dialog. currentProviderModel is the full "provider:model" identifier of the active model. recentModels is an optional MRU-ordered list of "provider:model" strings; matching items are floated to the top of the list.
func (*DialogModel) ShowSessionList ¶
func (d *DialogModel) ShowSessionList(items []DialogItem, currentSessionID string)
ShowSessionList opens the session list dialog. items should have ID=full session ID, Label=display name.
func (*DialogModel) Type ¶
func (d *DialogModel) Type() DialogType
Type returns the current dialog type
func (*DialogModel) Update ¶
func (d *DialogModel) Update(msg tea.Msg) (*DialogModel, tea.Cmd)
Update handles messages
type DialogType ¶
type DialogType int
DialogType represents the type of dialog
const ( DialogNone DialogType = iota DialogModelPicker DialogSessionList DialogDirApproval DialogMCPPicker DialogContent )
type DirApprovalRequest ¶
type DirApprovalRequest struct {
Path string // The file path that triggered the request
Options []string // Directory options to approve
OnApprove func(dir string)
OnDeny func()
}
DirApprovalRequest represents a pending directory approval request
type FileAttachment ¶
FileAttachment represents an attached file
func AttachFile ¶
func AttachFile(path string) (*FileAttachment, error)
AttachFile reads a file and creates an attachment
type FileCompletion ¶
FileCompletion represents a file path completion item
func ListFiles ¶
func ListFiles(dir string, query string) []FileCompletion
ListFiles returns files in a directory for completion
type FileCompletionSource ¶
type FileCompletionSource []FileCompletion
FileCompletionSource implements fuzzy.Source for file completions
func (FileCompletionSource) Len ¶
func (f FileCompletionSource) Len() int
func (FileCompletionSource) String ¶
func (f FileCompletionSource) String(i int) string
type FlushBeforeApprovalMsg ¶ added in v0.0.35
type FlushBeforeApprovalMsg struct {
Done chan<- struct{} // Signal when flush is complete
}
FlushBeforeApprovalMsg signals the TUI to flush content to scrollback before releasing the terminal for approval prompts.
type FlushBeforeAskUserMsg ¶ added in v0.0.35
type FlushBeforeAskUserMsg struct {
Done chan<- struct{} // Signal when flush is complete
}
FlushBeforeAskUserMsg signals the TUI to flush content to scrollback before releasing the terminal for ask_user prompts.
type HandoverRequestMsg ¶ added in v0.0.147
HandoverRequestMsg triggers a handover flow from a tool call.
type ImageAttachment ¶ added in v0.0.91
ImageAttachment represents an image attached to the next outgoing user message.
type KeyMap ¶
type KeyMap struct {
// Global
Quit key.Binding
Commands key.Binding
// Editor
Send key.Binding
Newline key.Binding
NewlineAlt key.Binding
ClearLine key.Binding
DeleteWord key.Binding
Cancel key.Binding
HistoryUp key.Binding
HistoryDown key.Binding
Tab key.Binding
// History navigation
PageUp key.Binding
PageDown key.Binding
// Shortcuts
Help key.Binding
SwitchModel key.Binding
CycleEffort key.Binding
ToggleWeb key.Binding
ToggleYolo key.Binding
Clear key.Binding
NewSession key.Binding
MCPPicker key.Binding
Inspector key.Binding
ExpandTools key.Binding
Copy key.Binding
}
KeyMap defines keybindings for the chat TUI
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg *config.Config, provider llm.Provider, engine *llm.Engine, providerKey string, modelName string, mcpManager *mcp.Manager, maxTurns int, forceExternalSearch bool, disableExternalWebFetch bool, searchEnabled bool, localTools []string, toolsStr string, mcpStr string, showStats bool, initialText string, store session.Store, sess *session.Session, altScreen bool, autoSendQueue []string, autoSendExitOnDone bool, textMode bool, agentName string, platformDeveloperMessage string, yolo bool) *Model
New creates a new chat model. fast-provider aware callers should use NewWithFastProvider.
func NewWithFastProvider ¶ added in v0.0.101
func NewWithFastProvider(cfg *config.Config, provider llm.Provider, fastProvider llm.Provider, engine *llm.Engine, providerKey string, modelName string, mcpManager *mcp.Manager, maxTurns int, forceExternalSearch bool, disableExternalWebFetch bool, searchEnabled bool, localTools []string, toolsStr string, mcpStr string, showStats bool, initialText string, store session.Store, sess *session.Session, altScreen bool, autoSendQueue []string, autoSendExitOnDone bool, textMode bool, agentName string, platformDeveloperMessage string, yolo bool) *Model
NewWithFastProvider creates a new chat model with an optional fast provider for control-plane classification tasks.
func (*Model) ExecuteCommand ¶
ExecuteCommand handles slash command execution
func (*Model) ReloadSessionID ¶ added in v0.0.102
ReloadSessionID returns the session ID to resume after a reload, if any.
func (*Model) RequestedHandoverAutoSend ¶ added in v0.0.134
RequestedHandoverAutoSend returns a message to auto-send after handover restart.
func (*Model) RequestedResumeSessionID ¶ added in v0.0.97
RequestedResumeSessionID returns a pending session ID to relaunch, if any.
func (*Model) SetAgentLister ¶ added in v0.0.134
SetAgentLister configures the function used to list available agent names for /handover completions.
func (*Model) SetAgentResolver ¶ added in v0.0.134
func (m *Model) SetAgentResolver(resolver func(name string, cfg *config.Config) (*agents.Agent, error))
SetAgentResolver configures the function used to resolve agent names during /handover. The function should match cmd.LoadAgent's signature.
func (*Model) SetApprovalManager ¶ added in v0.0.182
func (m *Model) SetApprovalManager(mgr *tools.ApprovalManager)
SetApprovalManager configures the active approval manager used by chat-level controls such as the yolo-mode toggle.
func (*Model) SetCurrentAgent ¶ added in v0.0.134
SetCurrentAgent sets the current agent configuration (used by /handover to check for enable_handover).
func (*Model) SetFooterWarning ¶ added in v0.0.236
SetFooterWarning sets a warning notice in the chat footer. It is intended for startup/configuration notices emitted before the Bubble Tea program is running.
func (*Model) SetHandoverApprovalManager ¶ added in v0.0.134
func (m *Model) SetHandoverApprovalManager(mgr *tools.ApprovalManager)
SetHandoverApprovalManager configures shell approval checks for handover scripts.
func (*Model) SetHandoverAutoSend ¶ added in v0.0.134
SetHandoverAutoSend sets a message to auto-send on Init (for handover restart).
func (*Model) SetHandoverSystemPromptResolver ¶ added in v0.0.305
func (m *Model) SetHandoverSystemPromptResolver(resolver func(agent *agents.Agent, providerKey, modelName string) (string, error))
SetHandoverSystemPromptResolver configures the normal chat-startup prompt pipeline used to resolve the target agent's persisted handover system prompt.
func (*Model) SetProgram ¶ added in v0.0.227
SetProgram gives the model a handle to the running Bubble Tea program for scheduling raw terminal writes that are discovered during View rendering.
func (*Model) SetRootContext ¶ added in v0.0.134
SetRootContext configures the parent context for long-running chat commands.
func (*Model) TakePostFrameImageSequence ¶ added in v0.0.234
func (*Model) WaitStreamDone ¶ added in v0.0.153
func (m *Model) WaitStreamDone()
WaitStreamDone blocks until the engine streaming goroutine has exited. It is safe to call when no stream was started (no-op).
func (*Model) WantsReload ¶ added in v0.0.102
WantsReload reports whether the user requested a binary reload via /reload.
func (*Model) YoloModeActive ¶ added in v0.0.224
YoloModeActive returns the current effective yolo state, including approval managers that may have been toggled during the session.
type ProviderInfo ¶
ProviderInfo holds provider and model information
func GetAvailableProviders ¶
func GetAvailableProviders(cfg *config.Config) []ProviderInfo
GetAvailableProviders returns providers with their models in consistent order If cfg is provided, custom configured providers are also included
type ResumeFromExternalUIMsg ¶ added in v0.0.35
type ResumeFromExternalUIMsg struct{}
ResumeFromExternalUIMsg signals that external UI (ask_user/approval) is done
type Selection ¶ added in v0.0.112
type Selection struct {
Active bool // true once a drag has started
Anchor ContentPos // drag start (fixed)
Cursor ContentPos // drag end (follows mouse)
Dragging bool // true between press and release
}
Selection tracks mouse-drag selection state in the viewport.
func (Selection) Normalized ¶ added in v0.0.112
func (s Selection) Normalized() (start, end ContentPos)
Normalized returns the selection range ordered so start <= end.
type SubagentProgressMsg ¶ added in v0.0.42
type SubagentProgressMsg struct {
CallID string
Event tools.SubagentEvent
}
SubagentProgressMsg carries progress events from running subagents.
type Subcommand ¶
Subcommand represents a subcommand of a slash command