Documentation
¶
Index ¶
- func ApplyTheme(name string)
- func CountLines(content string) int
- func FormatRef(id int, numLines int) string
- func GetAddModelChannel() <-chan struct{}
- func GetApprovalChannel() chan ToolApprovalRequestMsg
- func GetAskUserResponseChannel() <-chan AskUserResponse
- func GetCancelAgentChannel() <-chan struct{}
- func GetChannelActionChannel() <-chan ChannelAction
- func GetCompactChannel() <-chan struct{}
- func GetConfigChannel() <-chan *config.Config
- func GetMCPLoginChannel() <-chan string
- func GetModeSelectChannel() <-chan mode.SessionMode
- func GetPendingPromptChannel() <-chan string
- func GetPlanResponseChannel() <-chan PlanResponse
- func GetPromptChannel() <-chan string
- func GetResumeChannel() <-chan string
- func GetSSHChannel() <-chan interface{}
- func HeaderView() string
- func NormalizeLineEndings(s string) string
- func RenderCoordinatorPanel(ts *TeamViewState, width int) string
- func RenderTeamStatusPill(count int) string
- func RenderTeammateMessage(from, content, color, summary string) string
- func RenderTeammateViewHeader(identity team.TeammateIdentity) string
- func RequestMCPLogin(name string)
- func RunSetupTUI() (bool, error)
- type AddModelMsg
- type AgentDoneMsg
- type AgentMode
- type AgentTextMsg
- type AgentsMdMsg
- type ApprovalMode
- type AskUserQuestionMsg
- type AskUserResponse
- type BLECommandMsg
- type BatchRenderMsg
- type BgTaskDoneMsg
- type ChannelAction
- type ChannelInboundMsg
- type ChannelQRCodeMsg
- type ChannelStateMsg
- type CompactDoneMsg
- type CompactRequestMsg
- type ConfigUpdatedMsg
- type ExitTimeoutMsg
- type MCPNoticeMsg
- type MCPStatusItem
- type MCPStatusMsg
- type Mode
- type ModeSelectedMsg
- type Model
- type ModelOption
- type PasteStore
- type PlanApprovalMsg
- type PlanApprovedMsg
- type PlanRejectedMsg
- type PlanResponse
- type PromptSubmitMsg
- type ProviderProfile
- type ResumeRequestMsg
- type SSHCancelMsg
- type SSHConnectMsg
- type SSHDirResultsMsg
- type SSHListDirReqMsg
- type SSHStatusMsg
- type SessionEntry
- type SessionResumedMsg
- type SetupDoneMsg
- type SetupModel
- type SetupState
- type SidebarComponent
- type SidebarState
- type SkillSlashInfo
- type SkillSlashMsg
- type SkillsLoadedMsg
- type StatusBarComponent
- type StatusBarState
- type SubagentDoneMsg
- type SubagentProgressMsg
- type SubagentStartMsg
- type SubagentTokenUpdateMsg
- type TeamViewMode
- type TeamViewState
- func (t *TeamViewState) AppendTeammateLine(agentID string, lines ...string)
- func (t *TeamViewState) AppendTeammateText(agentID, text string)
- func (t *TeamViewState) FlushTeammateText(agentID string)
- func (t *TeamViewState) GetTeammateDisplayLines(agentID string) []string
- func (t *TeamViewState) HasTeam() bool
- func (t *TeamViewState) RefreshTeammates()
- type TodoSnapshotItem
- type TodoUpdateMsg
- type TokenUpdateMsg
- type ToolApprovalRequestMsg
- type ToolApprovalResponse
- type ToolCallMsg
- type ToolResultMsg
- type UserPromptMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTheme ¶ added in v0.5.2
func ApplyTheme(name string)
ApplyTheme switches the active palette and rebuilds all derived styles in place. Package-level style identifiers keep the same names, so all call sites pick up the new colors on the next render. Callers that cache rendered output (viewport lines, footer, sidebar) must invalidate it afterwards.
func CountLines ¶ added in v0.3.7
CountLines returns the number of lines in content (newlines + 1 if content is not empty).
func FormatRef ¶ added in v0.3.7
FormatRef returns a reference string for display. Example: "[Pasted text #1 +10 lines]"
func GetAddModelChannel ¶
func GetAddModelChannel() <-chan struct{}
GetAddModelChannel returns the channel that receives add-model requests.
func GetApprovalChannel ¶
func GetApprovalChannel() chan ToolApprovalRequestMsg
GetApprovalChannel returns the channel that receives tool approval requests.
func GetAskUserResponseChannel ¶
func GetAskUserResponseChannel() <-chan AskUserResponse
GetAskUserResponseChannel returns the channel for ask_user responses.
func GetCancelAgentChannel ¶ added in v0.3.2
func GetCancelAgentChannel() <-chan struct{}
GetCancelAgentChannel returns the channel that receives agent cancellation requests.
func GetChannelActionChannel ¶ added in v0.1.1
func GetChannelActionChannel() <-chan ChannelAction
GetChannelActionChannel returns the channel for channel action events.
func GetCompactChannel ¶
func GetCompactChannel() <-chan struct{}
GetCompactChannel returns the channel that receives compact requests.
func GetConfigChannel ¶
GetConfigChannel returns the channel that receives configuration changes.
func GetMCPLoginChannel ¶ added in v0.5.2
func GetMCPLoginChannel() <-chan string
GetMCPLoginChannel returns the channel for MCP OAuth login requests.
func GetModeSelectChannel ¶ added in v0.5.0
func GetModeSelectChannel() <-chan mode.SessionMode
GetModeSelectChannel returns the channel that receives session-mode changes.
func GetPendingPromptChannel ¶
func GetPendingPromptChannel() <-chan string
func GetPlanResponseChannel ¶
func GetPlanResponseChannel() <-chan PlanResponse
GetPlanResponseChannel returns the channel for plan responses.
func GetPromptChannel ¶
func GetPromptChannel() <-chan string
func GetResumeChannel ¶
func GetResumeChannel() <-chan string
GetResumeChannel returns the channel that receives session resume requests.
func GetSSHChannel ¶
func GetSSHChannel() <-chan interface{}
func HeaderView ¶
func HeaderView() string
func NormalizeLineEndings ¶ added in v0.3.7
NormalizeLineEndings converts \r\n and standalone \r to \n so that line-counting and display work correctly regardless of the source platform.
func RenderCoordinatorPanel ¶
func RenderCoordinatorPanel(ts *TeamViewState, width int) string
RenderCoordinatorPanel renders the team status panel at the bottom of the screen.
func RenderTeamStatusPill ¶
RenderTeamStatusPill renders a small "N teammates" indicator for the status bar.
func RenderTeammateMessage ¶
RenderTeammateMessage renders a message from a teammate with color and identity.
func RenderTeammateViewHeader ¶
func RenderTeammateViewHeader(identity team.TeammateIdentity) string
RenderTeammateViewHeader renders the header when viewing a teammate's conversation.
func RequestMCPLogin ¶ added in v0.5.2
func RequestMCPLogin(name string)
RequestMCPLogin asks the main goroutine to begin OAuth login for a server.
func RunSetupTUI ¶
Types ¶
type AddModelMsg ¶
type AddModelMsg struct{}
AddModelMsg signals that the user wants to add a new model via setup wizard
type AgentDoneMsg ¶
type AgentDoneMsg struct{ Err error }
type AgentTextMsg ¶
type AgentTextMsg struct{ Text string }
type AgentsMdMsg ¶
AgentsMdMsg is sent by the main goroutine to notify TUI that agents.md was loaded.
type ApprovalMode ¶
type ApprovalMode int
ApprovalMode represents the approval mode state
const ( ModeManual ApprovalMode = iota // Manual approval mode (default) ModeAuto // Auto-approve mode )
type AskUserQuestionMsg ¶
AskUserQuestionMsg is sent when the agent asks the user a question via ask_user tool.
type AskUserResponse ¶
type AskUserResponse struct {
Answer string
}
AskUserResponse is the user's answer to an ask_user question.
type BLECommandMsg ¶ added in v0.3.4
type BLECommandMsg struct {
Cmd string // "input", "submit", "cancel"
Val string // payload for "input" command
}
BLECommandMsg is sent when a command is received from a BLE device.
type BatchRenderMsg ¶ added in v0.4.10
type BatchRenderMsg struct{}
BatchRenderMsg is sent by the stream debounce timer to batch-flush accumulated AgentTextMsg content into a single viewport refresh.
type BgTaskDoneMsg ¶
BgTaskDoneMsg is sent when a background task completes.
type ChannelAction ¶ added in v0.1.1
type ChannelAction struct {
ChannelID string // "wechat"
Action string // "login", "logout", "enable", "disable"
}
ChannelAction represents an action the user wants to perform on a channel.
type ChannelInboundMsg ¶ added in v0.1.1
ChannelInboundMsg is sent when an inbound message arrives from a channel.
type ChannelQRCodeMsg ¶ added in v0.1.1
type ChannelQRCodeMsg struct {
ChannelID string
QRCodeURL string // image data or URL
QRCodeContent string // raw content to encode as terminal QR
Message string
}
ChannelQRCodeMsg is sent when a QR code is available for scanning.
type ChannelStateMsg ¶ added in v0.1.1
type ChannelStateMsg struct {
ChannelID string // "wechat"
State string // "none", "disabled", "enabled"
Message string // status message (e.g. "connected", "scanning...")
}
ChannelStateMsg is sent from the main goroutine to update channel state display in TUI.
type CompactDoneMsg ¶
CompactDoneMsg is sent when context compaction completes.
type CompactRequestMsg ¶
type CompactRequestMsg struct{}
CompactRequestMsg is sent when the user requests manual context compaction.
type ConfigUpdatedMsg ¶
ConfigUpdatedMsg is sent when the provider/model configuration is updated via setup wizard
type ExitTimeoutMsg ¶
type ExitTimeoutMsg struct{}
ExitTimeoutMsg is sent after 5s to clear exit confirmation
type MCPNoticeMsg ¶ added in v0.5.2
type MCPNoticeMsg struct {
Text string
}
MCPNoticeMsg is sent from the main goroutine to surface an MCP status line (login progress, errors) in the TUI transcript.
type MCPStatusItem ¶
type MCPStatusMsg ¶
type MCPStatusMsg struct {
Statuses []MCPStatusItem
}
type ModeSelectedMsg ¶ added in v0.5.0
type ModeSelectedMsg struct {
Mode mode.SessionMode
}
ModeSelectedMsg is sent from the main goroutine back to the TUI to sync the mode pill after the backend changes the session mode programmatically (resume restore, plan-completion revert, or echoing a Shift+Tab change).
type Model ¶
type Model struct {
// OnApprovalModeChange is called when the user promotes to auto-approve via the
// approval dialog's "Approve All". It updates the backend ApprovalState's
// approval axis directly (no agent rebuild), which is the correct fast path for
// a mid-run approval-only change. The unified Shift+Tab selector instead flows
// through modeSelectCh so it can also swap tools/prompt.
OnApprovalModeChange func(enabled bool)
// contains filtered or unexported fields
}
func (*Model) SetTeamManager ¶
SetTeamManager sets the team manager on the model for TUI integration.
type ModelOption ¶ added in v0.3.2
type ModelOption func(*Model)
ModelOption configures a Model before the BubbleTea program starts.
func WithApprovalModeChange ¶ added in v0.3.2
func WithApprovalModeChange(fn func(bool)) ModelOption
WithApprovalModeChange sets the callback invoked when the user promotes to auto-approve via the approval dialog's "Approve All". The callback directly updates the backend ApprovalState atomically, bypassing the event loop.
func WithGoalStore ¶ added in v0.5.0
func WithGoalStore(gs *tools.GoalStore) ModelOption
WithGoalStore wires the session goal store so the TUI can render the active goal indicator. The store is read directly when rendering.
func WithStartupMode ¶ added in v0.5.0
func WithStartupMode(sm mode.SessionMode) ModelOption
WithStartupMode seeds the initial selector mode so the mode pill reflects the resolved startup mode (config DefaultMode / legacy AutoApprove / --unsafe).
func WithTheme ¶ added in v0.5.2
func WithTheme(name string) ModelOption
WithTheme applies the persisted color theme at startup. A non-empty name marks the theme as explicit, suppressing terminal-background auto-detection.
func WithVersion ¶ added in v0.3.9
func WithVersion(v string) ModelOption
WithVersion sets the version string displayed in the bottom hint bar.
type PasteStore ¶ added in v0.3.7
type PasteStore struct {
// contains filtered or unexported fields
}
PasteStore stores multi-line content and provides reference-based access. It is used to collapse long pasted content in the TUI while preserving the full content for the agent.
func NewPasteStore ¶ added in v0.3.7
func NewPasteStore() *PasteStore
NewPasteStore creates a new PasteStore.
func (*PasteStore) Clear ¶ added in v0.3.7
func (ps *PasteStore) Clear()
Clear removes all stored content.
func (*PasteStore) ExpandRefs ¶ added in v0.3.7
func (ps *PasteStore) ExpandRefs(input string) string
ExpandRefs expands all paste references in the input with actual content from the store. This should be called before sending the prompt to the agent.
func (*PasteStore) Get ¶ added in v0.3.7
func (ps *PasteStore) Get(id int) (string, bool)
Get retrieves content by ID.
func (*PasteStore) Store ¶ added in v0.3.7
func (ps *PasteStore) Store(content string) int
Store stores content and returns a reference ID. Returns 0 if content should not be stored (less than minLinesForReference lines).
func (*PasteStore) StoreAndFormat ¶ added in v0.3.7
func (ps *PasteStore) StoreAndFormat(content string) string
StoreAndFormat stores content and returns the formatted reference string. If content is too short to collapse, returns the original content unchanged.
type PlanApprovalMsg ¶
PlanApprovalMsg is sent when the agent wants to show a plan for approval.
type PlanApprovedMsg ¶
type PlanApprovedMsg struct{}
PlanApprovedMsg is sent when the user approves a plan.
type PlanRejectedMsg ¶
type PlanRejectedMsg struct {
Feedback string
}
PlanRejectedMsg is sent when the user rejects a plan.
type PlanResponse ¶
PlanResponse is the user's response to a plan approval.
type PromptSubmitMsg ¶
type PromptSubmitMsg struct{ Prompt string }
type ProviderProfile ¶
type ProviderProfile struct {
ID string
Name string
BaseURL string
NeedURL bool // if true, prompt for custom URL
NeedKey bool // if true, prompt for API Key
FromRegistry bool // true if provider exists in models.dev
}
ProviderProfile holds the minimal info needed for the setup wizard flow.
type ResumeRequestMsg ¶
type ResumeRequestMsg struct{ UUID string }
ResumeRequestMsg is sent when the user requests to resume a session by UUID.
type SSHCancelMsg ¶
type SSHCancelMsg struct{}
SSHCancelMsg is sent when user cancels the SSH dir picker via Esc.
type SSHConnectMsg ¶
SSHConnectMsg is sent when user initially requests connection
type SSHDirResultsMsg ¶
SSHDirResultsMsg is sent from main to TUI with directory contents
type SSHListDirReqMsg ¶
type SSHListDirReqMsg struct {
Path string
}
SSHListDirReqMsg is sent when TUI needs to list a directory on the remote machine
type SSHStatusMsg ¶
SSHStatusMsg carries the result of an SSH connection attempt.
type SessionEntry ¶
type SessionEntry struct {
Type string
Content string
Name string
Args string
Output string
Error string
ToolCallID string
SubagentName string
SubagentType string
// Plan fields
PlanStatus string
PlanTitle string
PlanContent string
Feedback string
// Todo fields
Todos []TodoSnapshotItem
// Mode change
Mode string
// Compact fields
Summary string
CompactedN int
}
SessionEntry is a display-ready record from a replayed session.
func ConvertSessionEntries ¶
func ConvertSessionEntries(entries []session.Entry) []SessionEntry
ConvertSessionEntries converts recorded session entries to display-ready SessionEntry values for the TUI session-replay view.
type SessionResumedMsg ¶
type SessionResumedMsg struct {
UUID string
Entries []SessionEntry
}
SessionResumedMsg is sent by the main goroutine to replay a session in the TUI.
type SetupDoneMsg ¶
type SetupDoneMsg struct{}
type SetupModel ¶
type SetupModel struct {
// contains filtered or unexported fields
}
func NewSetupModel ¶
func NewSetupModel() SetupModel
func (SetupModel) Init ¶
func (m SetupModel) Init() tea.Cmd
func (SetupModel) IsDone ¶
func (m SetupModel) IsDone() bool
func (SetupModel) View ¶
func (m SetupModel) View() tea.View
type SetupState ¶
type SetupState int
const ( StateProvider SetupState = iota StateModel StateCustomModel StateURL StateAPIKey )
type SidebarComponent ¶ added in v0.3.5
type SidebarComponent struct{}
SidebarComponent renders the right-hand info panel.
func NewSidebarComponent ¶ added in v0.3.5
func NewSidebarComponent() *SidebarComponent
NewSidebarComponent creates a new sidebar component.
func (*SidebarComponent) View ¶ added in v0.3.5
func (s *SidebarComponent) View(state SidebarState) string
View renders the sidebar. Content is built line-by-line to ensure it never exceeds state.Height. Each section is appended until the height budget is exhausted.
type SidebarState ¶ added in v0.3.5
type SidebarState struct {
Width int
Height int
TotalWidth int // full width including borders
EnvLabel string
ActiveProvider string
ActiveModel string
TotalTokens int64
ModelContextLimit int
TodoItems []tools.TodoItem
TodoScrollOffset int
MCPStatuses []MCPStatusItem
TeammateCount int
BgRunning int
Version string
}
SidebarState holds the data needed to render the right sidebar.
type SkillSlashInfo ¶
SkillSlashInfo describes a skill's slash command for TUI hint display.
type SkillSlashMsg ¶
type SkillSlashMsg struct {
SkillName string // skill name to load
UserInput string // additional user input after the slash command
}
SkillSlashMsg is sent when a user triggers a slash command mapped to a skill.
type SkillsLoadedMsg ¶
type SkillsLoadedMsg struct {
SlashCommands []SkillSlashInfo
}
SkillsLoadedMsg is sent at startup to inform the TUI about available skill slash commands.
type StatusBarComponent ¶
type StatusBarComponent struct {
}
StatusBarComponent is a stateless-like component in Bubble Tea.
func NewStatusBarComponent ¶
func NewStatusBarComponent() *StatusBarComponent
func (*StatusBarComponent) View ¶
func (s *StatusBarComponent) View(state StatusBarState) string
View returns the rendered status bar.
type StatusBarState ¶
type StatusBarState struct {
Width int
ActiveProvider string
ActiveModel string
AutoApprove bool
TotalTokens int64
ModelContextLimit int
MCPStatuses []MCPStatusItem
Mode AgentMode
BgRunning int
TeammateCount int
}
StatusBarState holds the props supplied to the StatusBar component
type SubagentDoneMsg ¶
SubagentDoneMsg is sent when a subagent finishes.
type SubagentProgressMsg ¶
type SubagentProgressMsg struct {
AgentName string
Event string // "tool_call" or "tool_result"
ToolName string
Detail string
}
SubagentProgressMsg is sent for intermediate subagent events (tool calls / results).
type SubagentStartMsg ¶
SubagentStartMsg is sent when a subagent begins executing.
type SubagentTokenUpdateMsg ¶
type SubagentTokenUpdateMsg struct {
TotalTokens int64 // cumulative tokens used by the subagent since it started
}
SubagentTokenUpdateMsg is sent after each model turn to update the subagent's token usage.
type TeamViewMode ¶
type TeamViewMode int
TeamViewMode represents what the user is viewing.
const ( TeamViewLeader TeamViewMode = iota // viewing leader's conversation TeamViewTeammate // viewing a teammate's conversation TeamViewPanel // navigating coordinator panel )
type TeamViewState ¶
type TeamViewState struct {
Manager *team.Manager
ViewingAgent string // agentID of currently viewed teammate ("" = leader)
PanelVisible bool // show coordinator panel
PanelSelected int // selected index in coordinator panel
ViewMode TeamViewMode
Teammates []*team.TeammateState // cached snapshot
// Per-teammate display lines, keyed by agentID.
TeammateLines map[string][]string
TeammateCurrentText map[string]*strings.Builder
}
TeamViewState tracks team-related TUI state.
func (*TeamViewState) AppendTeammateLine ¶
func (t *TeamViewState) AppendTeammateLine(agentID string, lines ...string)
AppendTeammateLine adds a formatted display line for a teammate.
func (*TeamViewState) AppendTeammateText ¶
func (t *TeamViewState) AppendTeammateText(agentID, text string)
AppendTeammateText appends streaming text for a teammate.
func (*TeamViewState) FlushTeammateText ¶
func (t *TeamViewState) FlushTeammateText(agentID string)
FlushTeammateText flushes any buffered streaming text for a teammate into a line.
func (*TeamViewState) GetTeammateDisplayLines ¶
func (t *TeamViewState) GetTeammateDisplayLines(agentID string) []string
GetTeammateDisplayLines returns the accumulated display lines for a teammate.
func (*TeamViewState) HasTeam ¶
func (t *TeamViewState) HasTeam() bool
HasTeam returns true if a team is active.
func (*TeamViewState) RefreshTeammates ¶
func (t *TeamViewState) RefreshTeammates()
RefreshTeammates updates the cached teammate list.
type TodoSnapshotItem ¶ added in v0.3.3
type TodoSnapshotItem struct {
ID int `json:"id"`
Title string `json:"title"`
Status string `json:"status"`
}
TodoSnapshotItem mirrors session.TodoSnapshotItem for TUI display.
type TodoUpdateMsg ¶
type TodoUpdateMsg struct{}
TodoUpdateMsg signals that the todo store has been updated.
type TokenUpdateMsg ¶
TokenUpdateMsg is sent periodically to update token usage display
type ToolApprovalRequestMsg ¶
type ToolApprovalRequestMsg struct {
Name string
Args string
Resp chan ToolApprovalResponse
IsExternal bool // Whether this is an external path access (for read tool)
WorkerName string // Non-empty when approval is from a teammate (e.g. "@backend")
WorkerColor string // Teammate's color for TUI display
}
ToolApprovalRequestMsg is sent when a tool needs user approval
type ToolApprovalResponse ¶
type ToolApprovalResponse struct {
Approved bool
Mode ApprovalMode // Mode after this response (stay MANUAL or switch to AUTO)
}
ToolApprovalResponse is the user's response to a tool approval request
type ToolCallMsg ¶
type ToolResultMsg ¶
type UserPromptMsg ¶
type UserPromptMsg struct{ Prompt string }
Source Files
¶
- approval.go
- channel_panel.go
- content_line.go
- content_render.go
- format.go
- history.go
- input_layout.go
- input_views.go
- list_items.go
- manage_models.go
- mcp_command.go
- messages.go
- paste_store.go
- perf.go
- pickers.go
- session_helper.go
- setup.go
- sidebar_component.go
- ssh_handlers.go
- statusbar_component.go
- styles.go
- team_view.go
- theme_picker.go
- tui.go
- update.go
- view_render.go