Documentation
¶
Overview ¶
SPDX-License-Identifier: MIT Purpose: TUI-side adapter for the chat.Input widget. Avoids the `*chat.Input` direct dep in model.go by wrapping it in a local type. Submits are routed through a chat.Runner (lazy-init singleton) and the LLM call runs in a background goroutine so the UI stays responsive.
SPDX-License-Identifier: MIT Purpose: thin bridge so *tea.Program (which has Send(msg tea.Msg)) can be stored in the Model.Program field typed as the local teaProgramIface interface. Imported in main.go via tui.ProgramFromTeaProgram().
SPDX-License-Identifier: MIT Purpose: render the chat view in the TUI center panel. Shows recent history at the top, chat input at the bottom.
SPDX-License-Identifier: MIT Purpose: Notification banner rendering + keybindings (o=open, d=dismiss, n=next).
SPDX-License-Identifier: MIT Purpose: glue between TUI and the notifications package — converts notification types to the TeaMsg types defined in messages.go.
SPDX-License-Identifier: MIT Purpose: Todos view — list todos with priority badges, live counts.
Index ¶
- Variables
- func BannerDismissCmd(id string) tea.Cmd
- func BannerOpenCmd(id string) tea.Cmd
- func ComposeLayout(tabs Tabs, sidebar Sidebar, view ViewKind, content string, right string, ...) string
- func ListenForNotifications() tea.Cmd
- func ProgramFromTeaProgram(p *tea.Program) teaProgramIface
- func RefreshTodosCmd() tea.Cmd
- func RenderCommandPalette(items []string, sel int, query string, styles Styles, width, height int) string
- func RenderConfigView(entries []ConfigEntry, selected int, styles Styles, width, height int) string
- func RenderEFMView(stacks []EFMStack, styles Styles, width, height int, spinner Spinner) string
- func RenderHistoryView(entries []HistoryEntry, selected int, styles Styles, width, height int) string
- func RenderRightPanel(sel *ToolSubItem, view ViewKind, styles Styles, width, height int) string
- func RenderSessionsView(styles Styles, tabs Tabs, width, height int) string
- func RenderSubagentsPopup(styles Styles, width, height int) string
- func RenderToolsView(sidebar Sidebar, styles Styles, width, height int) string
- type AgentCycleMsg
- type ArgInputState
- type BannerKeyMsg
- type ConfigEntry
- type CountsMsg
- type EFMRefreshMsg
- type EFMStack
- type Footer
- type HintPair
- type HistoryAppendMsg
- type HistoryEntry
- type InterruptMsg
- type Mode
- type Model
- func (m *Model) AppendHistory(view, action, detail string, ok bool)
- func (m *Model) ApplyTheme()
- func (m *Model) BannerNext()
- func (m *Model) CloseArgInput()
- func (m *Model) ClosePalette()
- func (m *Model) CloseSubagents()
- func (m *Model) CycleTheme()
- func (m *Model) DismissBanner()
- func (m *Model) Init() tea.Cmd
- func (m *Model) NextView()
- func (m *Model) OpenArgInput(cmd string)
- func (m *Model) OpenPalette()
- func (m *Model) OpenSubagents()
- func (m *Model) PrevView()
- func (m *Model) PreviousView()
- func (m *Model) RenderBanner(styles Styles, width int) string
- func (m *Model) RenderTodos(styles Styles, width, height int) string
- func (m *Model) RunSelected()
- func (m *Model) SetBanner(n *NotificationItem)
- func (m *Model) SetContextFn(fn func() context.Context)
- func (m *Model) SwitchView(v ViewKind)
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() tea.View
- type NotificationItem
- type NotificationMsg
- type NotificationSource
- type PaletteOpenMsg
- type PaletteState
- type Session
- type SessionAddMsg
- type SessionCloseMsg
- type SessionSelectMsg
- type Sidebar
- func (s *Sidebar) MoveDown()
- func (s *Sidebar) MoveUp()
- func (s *Sidebar) SelectedTool() *ToolSubItem
- func (s *Sidebar) SelectedView() ViewKind
- func (s *Sidebar) SetSelectedView(v ViewKind)
- func (s *Sidebar) Toggle()
- func (s *Sidebar) ToolMoveDown()
- func (s *Sidebar) ToolMoveUp()
- func (s Sidebar) View(styles Styles) string
- type SidebarItem
- type SidebarToggleMsg
- type Spinner
- type SpinnerTickMsg
- type Styles
- type SubagentsOpenMsg
- type Tabs
- type Theme
- type ThemeChangedMsg
- type TodoRow
- type TodosLoadedMsg
- type ToolRunMsg
- type ToolSubItem
- type ViewKind
- type ViewSwitchMsg
Constants ¶
This section is empty.
Variables ¶
var AgentNames = []string{"Build", "Audit", "Stats"}
var Themes = []Theme{
{
Name: "default",
Accent: "#7D56F4",
AccentDim: "#5E40BF",
Text: "#FFFFFF",
TextDim: "#808080",
Background: "#1E1E2E",
Border: "#7D56F4",
Success: "#50FA7B",
Warn: "#F1FA8C",
Error: "#FF5555",
},
{
Name: "Dracula",
Accent: "#FF79C6",
AccentDim: "#BD93F9",
Text: "#F8F8F2",
TextDim: "#6272A4",
Background: "#282A36",
Border: "#FF79C6",
Success: "#50FA7B",
Warn: "#F1FA8C",
Error: "#FF5555",
},
{
Name: "Nord",
Accent: "#88C0D0",
AccentDim: "#5E81AC",
Text: "#ECEFF4",
TextDim: "#4C566A",
Background: "#2E3440",
Border: "#88C0D0",
Success: "#A3BE8C",
Warn: "#EBCB8B",
Error: "#BF616A",
},
{
Name: "Solarized",
Accent: "#B58900",
AccentDim: "#CB4B16",
Text: "#FDF6E3",
TextDim: "#93A1A1",
Background: "#002B36",
Border: "#B58900",
Success: "#859900",
Warn: "#B58900",
Error: "#DC322F",
},
{
Name: "Monokai",
Accent: "#A6E22E",
AccentDim: "#66D9EF",
Text: "#F8F8F2",
TextDim: "#75715E",
Background: "#272822",
Border: "#A6E22E",
Success: "#A6E22E",
Warn: "#E6DB74",
Error: "#F92672",
},
}
Functions ¶
func BannerDismissCmd ¶
func BannerOpenCmd ¶
func ComposeLayout ¶
func ListenForNotifications ¶
ListenForNotifications returns a tea.Cmd that blocks on the notifications broadcaster channel and emits a NotificationMsg when one arrives. Re-subscribe from Update after each NotificationMsg to keep listening.
func ProgramFromTeaProgram ¶
ProgramFromTeaProgram wraps a *tea.Program so it satisfies teaProgramIface. Returns nil if p is nil.
func RefreshTodosCmd ¶
RefreshTodosCmd returns a tea.Cmd that re-counts todos.
func RenderCommandPalette ¶
func RenderConfigView ¶
func RenderConfigView(entries []ConfigEntry, selected int, styles Styles, width, height int) string
func RenderEFMView ¶
func RenderHistoryView ¶
func RenderHistoryView(entries []HistoryEntry, selected int, styles Styles, width, height int) string
func RenderRightPanel ¶
func RenderRightPanel(sel *ToolSubItem, view ViewKind, styles Styles, width, height int) string
func RenderSessionsView ¶
func RenderSubagentsPopup ¶
Types ¶
type AgentCycleMsg ¶
type AgentCycleMsg struct {
Index int
}
type ArgInputState ¶
type BannerKeyMsg ¶
type BannerKeyMsg struct {
Action string
}
type ConfigEntry ¶
func DefaultConfigEntries ¶
func DefaultConfigEntries() []ConfigEntry
type EFMRefreshMsg ¶
type EFMRefreshMsg struct {
Stacks []EFMStack
}
type Footer ¶
type Footer struct {
// contains filtered or unexported fields
}
func (*Footer) CycleAgent ¶
func (f *Footer) CycleAgent()
func (Footer) ProgressBar ¶
type HintPair ¶
func DefaultHints ¶
type HistoryAppendMsg ¶
type HistoryAppendMsg struct {
Entry HistoryEntry
}
type HistoryEntry ¶
type InterruptMsg ¶
type InterruptMsg struct{}
type Model ¶
type Model struct {
Width int
Height int
ThemeIdx int
ViewKind ViewKind
Mode Mode
Quitting bool
Ready bool
Loading bool
Tabs Tabs
Sidebar Sidebar
Spinner Spinner
Styles Styles
RightPanel bool
Palette PaletteState
ArgInput ArgInputState
History []HistoryEntry
EFMStks []EFMStack
Config []ConfigEntry
ConfigSel int
ToolList list.Model
ToolItems []list.Item
TodoItems []TodoRow
TodoSel int
NotificationBanner *NotificationItem
Notifications []NotificationItem
ChatInput *chatInput
ChatHistory []string
ChatRunner *chat.Runner
Program teaProgramIface
OnRun func(name string, args []string) error
// contains filtered or unexported fields
}
Model is the top-level TUI model. Program, ChatRunner, and ctxFn are optional — when nil, the chat submit path falls back to synchronous behavior (used by tests and headless invocations).
func (*Model) AppendHistory ¶
func (*Model) ApplyTheme ¶
func (m *Model) ApplyTheme()
func (*Model) BannerNext ¶
func (m *Model) BannerNext()
func (*Model) CloseArgInput ¶
func (m *Model) CloseArgInput()
func (*Model) ClosePalette ¶
func (m *Model) ClosePalette()
func (*Model) CloseSubagents ¶
func (m *Model) CloseSubagents()
func (*Model) CycleTheme ¶
func (m *Model) CycleTheme()
func (*Model) DismissBanner ¶
func (m *Model) DismissBanner()
func (*Model) OpenArgInput ¶
func (*Model) OpenPalette ¶
func (m *Model) OpenPalette()
func (*Model) OpenSubagents ¶
func (m *Model) OpenSubagents()
func (*Model) PreviousView ¶
func (m *Model) PreviousView()
func (*Model) RunSelected ¶
func (m *Model) RunSelected()
func (*Model) SetBanner ¶
func (m *Model) SetBanner(n *NotificationItem)
func (*Model) SetContextFn ¶
SetContextFn lets tests inject a cancellable context.
func (*Model) SwitchView ¶
type NotificationItem ¶
func (NotificationItem) GetID ¶
func (n NotificationItem) GetID() string
func (NotificationItem) GetMessage ¶
func (n NotificationItem) GetMessage() string
func (NotificationItem) GetTitle ¶
func (n NotificationItem) GetTitle() string
func (NotificationItem) GetType ¶
func (n NotificationItem) GetType() string
type NotificationMsg ¶
type NotificationMsg struct {
N NotificationSource
}
NotificationMsg is fired when the TUI receives a new notification from the sin-code notifications broadcaster.
type NotificationSource ¶
type NotificationSource interface {
GetID() string
GetTitle() string
GetMessage() string
GetType() string
}
NotificationSource is the interface used by NotificationMsg to access notification fields. Implemented by *notifications.Notification and by test doubles in todos_view_test.go.
type PaletteOpenMsg ¶
type PaletteOpenMsg struct {
Open bool
}
type PaletteState ¶
type SessionAddMsg ¶
type SessionAddMsg struct {
Name string
}
type SessionCloseMsg ¶
type SessionCloseMsg struct {
Index int
}
type SessionSelectMsg ¶
type SessionSelectMsg struct {
Index int
}
type Sidebar ¶
type Sidebar struct {
Items []SidebarItem
Selected int
Width int
Collapsed bool
ToolSubItems []ToolSubItem
ToolSel int
TodoOpen int
TodoBlocked int
TodoOverdue int
TodoReady int
}
func NewSidebar ¶
func NewSidebar() Sidebar
func (*Sidebar) SelectedTool ¶
func (s *Sidebar) SelectedTool() *ToolSubItem
func (*Sidebar) SelectedView ¶
func (*Sidebar) SetSelectedView ¶
func (*Sidebar) ToolMoveDown ¶
func (s *Sidebar) ToolMoveDown()
func (*Sidebar) ToolMoveUp ¶
func (s *Sidebar) ToolMoveUp()
type SidebarItem ¶
func DefaultSidebarItems ¶
func DefaultSidebarItems() []SidebarItem
type SidebarToggleMsg ¶
type SidebarToggleMsg struct{}
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
func NewSpinner ¶
func NewSpinner() Spinner
type SpinnerTickMsg ¶
type Styles ¶
type Styles struct {
Theme Theme
Header lipgloss.Style
TabActive lipgloss.Style
TabIdle lipgloss.Style
TabAdd lipgloss.Style
Sidebar lipgloss.Style
SidebarSel lipgloss.Style
SidebarHdr lipgloss.Style
Content lipgloss.Style
ContentHdr lipgloss.Style
Popup lipgloss.Style
PopupItem lipgloss.Style
PopupSel lipgloss.Style
Spinner lipgloss.Style
Progress lipgloss.Style
StatusOK lipgloss.Style
StatusWarn lipgloss.Style
StatusErr lipgloss.Style
Hint lipgloss.Style
AccentText lipgloss.Style
Bold lipgloss.Style
Muted lipgloss.Style
}
func (Styles) BorderColor ¶
type SubagentsOpenMsg ¶
type SubagentsOpenMsg struct {
Open bool
}
type ThemeChangedMsg ¶
type ThemeChangedMsg struct {
Index int
}
type TodoRow ¶
type TodoRow struct {
ID string
Title string
Priority string
Status string
Type string
Assignee string
}
TodoRow is a lightweight struct for displaying todos in the TUI.
type TodosLoadedMsg ¶
type TodosLoadedMsg struct {
Items []TodoRow
}
TodosLoadedMsg is fired when the todo list is reloaded.
type ToolRunMsg ¶
type ToolSubItem ¶
func DefaultToolSubItems ¶
func DefaultToolSubItems() []ToolSubItem
type ViewSwitchMsg ¶
type ViewSwitchMsg struct {
View ViewKind
}