Documentation
¶
Overview ¶
Package ui holds Loom's Bubble Tea view components.
The layout splits the screen into a left-hand List of instances (≈20 % width) and a right-hand SplitPane (≈80 %) with stacked Agent and Terminal panes plus a hotkey-toggled diff overlay. Secondary widgets — the workspace tab bar, quick-input bar, and menu bar — compose around that main split.
Modal dialogs (text input, confirmation, branch/profile/workspace pickers) live in ui/overlay. Renderers here are pure: they read core.InstanceView values and emit strings; they do not mutate instances or spawn goroutines. Event handling happens in the app layer.
Index ¶
- Constants
- Variables
- func AccountUsageText(s AccountStatus, now time.Time) string
- func AdjustPreviewWidth(width int) int
- func ApplyTheme(name string) bool
- func ContentTailLines(screen string, n int) []string
- func CurrentThemeName() string
- func DisplayIndex(items []core.InstanceView, i int) int
- func IsMarkdownPath(path string) bool
- func MessageTailLines(msg string, n int) []string
- func RegisterThemeHook(fn func())
- func RenderCard(d CardData, density CardDensity, width int) string
- func SetShowAccounts(on bool)
- func ShowAccounts() bool
- func SortForOverview(items []core.InstanceView) []int
- func TailLines(screen string, n int) []string
- func ThemeNames() []string
- type AccountStatus
- type AccountStrip
- type CardData
- type CardDensity
- type DiffPane
- func (d *DiffPane) GotoBottom()
- func (d *DiffPane) GotoTop()
- func (d *DiffPane) PageDown()
- func (d *DiffPane) PageUp()
- func (d *DiffPane) ScrollDown()
- func (d *DiffPane) ScrollPercent() float64
- func (d *DiffPane) ScrollUp()
- func (d *DiffPane) SetDiff(instance *core.InstanceView)
- func (d *DiffPane) SetSize(width, height int)
- func (d *DiffPane) String() string
- type ErrBox
- type GroupState
- type InstanceSource
- type List
- func (l *List) Bottom()
- func (l *List) Down()
- func (l *List) GetInstanceByTitle(title string) *core.InstanceView
- func (l *List) GetInstances() []core.InstanceView
- func (l *List) GetSelectedInstance() *core.InstanceView
- func (l *List) NumInstances() int
- func (l *List) PageDown()
- func (l *List) PageUp()
- func (l *List) PeerSections() []PeerSection
- func (l *List) SelectID(id core.InstanceID)
- func (l *List) SelectedIdx() int
- func (l *List) SetPanes(panes *PaneClients)
- func (l *List) SetPeerSections(peers []PeerSection)
- func (l *List) SetSelectedInstance(idx int)
- func (l *List) SetSessionPreviewSize(width, height int) (err error)
- func (l *List) SetSize(width, height int)
- func (l *List) SetWorkspaceName(name string)
- func (l *List) Size() (width, height int)
- func (l *List) String() string
- func (l *List) Top()
- func (l *List) Up()
- func (l *List) WorkspaceName() string
- type MarkdownPane
- func (m *MarkdownPane) ApplySaved(raw string, mtime time.Time)
- func (m *MarkdownPane) CancelEdit()
- func (m *MarkdownPane) Clear()
- func (m *MarkdownPane) EditDirty() bool
- func (m *MarkdownPane) EditValue() string
- func (m *MarkdownPane) Editing() bool
- func (m *MarkdownPane) Following() bool
- func (m *MarkdownPane) HandleEditKey(msg tea.KeyPressMsg)
- func (m *MarkdownPane) Mtime() time.Time
- func (m *MarkdownPane) PageDown()
- func (m *MarkdownPane) PageUp()
- func (m *MarkdownPane) Path() string
- func (m *MarkdownPane) Scroll() int
- func (m *MarkdownPane) ScrollBottom()
- func (m *MarkdownPane) ScrollDown()
- func (m *MarkdownPane) ScrollTop()
- func (m *MarkdownPane) ScrollUp()
- func (m *MarkdownPane) SetDocument(path, raw string, mtime time.Time)
- func (m *MarkdownPane) SetFollowing(f bool)
- func (m *MarkdownPane) SetSize(width, height int)
- func (m *MarkdownPane) StartEdit() bool
- func (m *MarkdownPane) View() string
- type Menu
- func (m *Menu) ClearKeydown()
- func (m *Menu) Instance() *core.InstanceView
- func (m *Menu) Keydown(name keys.KeyName)
- func (m *Menu) SetInstance(instance *core.InstanceView)
- func (m *Menu) SetSize(width, height int)
- func (m *Menu) SetState(state MenuState)
- func (m *Menu) State() MenuState
- func (m *Menu) String() string
- type MenuState
- type Overview
- type OverviewCursor
- type OverviewData
- type OverviewGroup
- type Pane
- func (p Pane) Attached() bool
- func (p Pane) CaptureHistory() (string, bool)
- func (p Pane) Client() *tmux.TmuxSession
- func (p Pane) CursorState() (vt.Cursor, bool)
- func (p Pane) DetectStatus() (updated, hasPrompt bool, err error)
- func (p Pane) EmulatorScreen() (string, bool)
- func (p Pane) ForwardFocus(in bool)
- func (p Pane) ForwardMouse(cb, col, row int, press bool) error
- func (p Pane) ForwardWheel(up bool, n int) error
- func (p Pane) GetContentHash() []byte
- func (p Pane) HasEmulator() bool
- func (p Pane) IsAlternateScreen() bool
- func (p Pane) PaneTitle() (string, bool)
- func (p Pane) Paste(text string) error
- func (p Pane) Preview() (string, error)
- func (p Pane) SendKeysRaw(b []byte) error
- func (p Pane) SetPreviewSize(width, height int) error
- type PaneClients
- func (p *PaneClients) Alive(sessionName string) bool
- func (p *PaneClients) Ensure(sessionName, program string) error
- func (p *PaneClients) For(v *core.InstanceView) Pane
- func (p *PaneClients) Get(sessionName string) *tmux.TmuxSession
- func (p *PaneClients) InjectForTest(sessionName string, c *tmux.TmuxSession)
- func (p *PaneClients) Replace(sessionName, program string) (*tmux.TmuxSession, error)
- func (p *PaneClients) Retain(keep map[string]bool) []*tmux.TmuxSession
- func (p *PaneClients) SetClientFactoryForTest(f func(sessionName, program string) *tmux.TmuxSession)
- func (p *PaneClients) SetClockForTest(now func() time.Time)
- func (p *PaneClients) SetDefaultSize(cols, rows int)
- type PeerSection
- type PreviewPane
- func (p *PreviewPane) BeginSelection(row, col int)
- func (p *PreviewPane) ClearSelection()
- func (p *PreviewPane) ExtendSelection(row, col int)
- func (p *PreviewPane) GotoBottom(instance *core.InstanceView) error
- func (p *PreviewPane) GotoTop(instance *core.InstanceView) error
- func (p *PreviewPane) IsScrolling() bool
- func (p *PreviewPane) PageDown(instance *core.InstanceView) error
- func (p *PreviewPane) PageUp(instance *core.InstanceView) error
- func (p *PreviewPane) ResetToNormalMode(instance *core.InstanceView) error
- func (p *PreviewPane) ScrollDown(instance *core.InstanceView) error
- func (p *PreviewPane) ScrollPercent() float64
- func (p *PreviewPane) ScrollUp(instance *core.InstanceView) error
- func (p *PreviewPane) SelectedText() string
- func (p *PreviewPane) SetPanes(panes *PaneClients)
- func (p *PreviewPane) SetSize(width, maxHeight int)
- func (p *PreviewPane) ShowingFallback() bool
- func (p *PreviewPane) String() string
- func (p *PreviewPane) UpdateContent(instance *core.InstanceView) error
- type QuickInputAction
- type QuickInputBar
- type QuickInputTarget
- type ReviewPane
- type ScrollModel
- func (m *ScrollModel) AdvanceAndRender(src scrollSource, rows int) (window string, live bool, ok bool)
- func (m *ScrollModel) GotoTop(src scrollSource)
- func (m *ScrollModel) IsScrolling() bool
- func (m *ScrollModel) NeedsAltProbe() bool
- func (m *ScrollModel) NewLinesBelow() int
- func (m *ScrollModel) PageDown(src scrollSource, height int) error
- func (m *ScrollModel) PageUp(src scrollSource, height int) error
- func (m *ScrollModel) Reset()
- func (m *ScrollModel) ScrollBy(src scrollSource, delta int)
- func (m *ScrollModel) ScrollDown(src scrollSource) error
- func (m *ScrollModel) ScrollPercent(src scrollSource) float64
- func (m *ScrollModel) ScrollUp(src scrollSource) error
- func (m *ScrollModel) SetAltProbe(alt bool)
- type SplitPane
- func (s *SplitPane) AdjustAgentRatio(delta float64) float64
- func (s *SplitPane) AgentContentHeight() int
- func (s *SplitPane) AgentRatio() float64
- func (s *SplitPane) BeginSelection(pane, row, col int)
- func (s *SplitPane) ClearSelections()
- func (s *SplitPane) CurrentTerminalSessionName() string
- func (s *SplitPane) CursorScreenPosition(instance *core.InstanceView) (x, y int, cur vt.Cursor, ok bool)
- func (s *SplitPane) ExtendSelection(pane, row, col int)
- func (s *SplitPane) ForwardTerminalFocus(in bool)
- func (s *SplitPane) ForwardTerminalMouse(cb, col, row int, press bool) error
- func (s *SplitPane) GetAgentSize() (width, height int)
- func (s *SplitPane) GetFocusedPane() int
- func (s *SplitPane) GotoBottom()
- func (s *SplitPane) GotoTop()
- func (s *SplitPane) HitTest(localX, y int) (pane, row, col int, ok bool)
- func (s *SplitPane) InjectTerminalSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
- func (s *SplitPane) Instance() *core.InstanceView
- func (s *SplitPane) IsAgentInScrollMode() bool
- func (s *SplitPane) IsDiffVisible() bool
- func (s *SplitPane) IsTerminalHidden() bool
- func (s *SplitPane) IsTerminalInScrollMode() bool
- func (s *SplitPane) PageDown()
- func (s *SplitPane) PageTerminalDown()
- func (s *SplitPane) PageTerminalUp()
- func (s *SplitPane) PageUp()
- func (s *SplitPane) PasteTerminal(text string) error
- func (s *SplitPane) ResetAgentToNormalMode(instance *core.InstanceView) error
- func (s *SplitPane) ResetTerminalToNormalMode()
- func (s *SplitPane) ScrollAgentDown()
- func (s *SplitPane) ScrollAgentUp()
- func (s *SplitPane) ScrollDiffDown()
- func (s *SplitPane) ScrollDiffUp()
- func (s *SplitPane) ScrollDown()
- func (s *SplitPane) ScrollTerminalDown()
- func (s *SplitPane) ScrollTerminalUp()
- func (s *SplitPane) ScrollUp()
- func (s *SplitPane) SelectedText(pane int) string
- func (s *SplitPane) SendTerminalKeysRaw(b []byte) error
- func (s *SplitPane) SendTerminalKeysToInstance(title, text string) error
- func (s *SplitPane) SendTerminalPrompt(text string) error
- func (s *SplitPane) SetAgentRatio(r float64)
- func (s *SplitPane) SetFocusedPane(pane int)
- func (s *SplitPane) SetInlineAttach(attached bool)
- func (s *SplitPane) SetInstance(instance *core.InstanceView)
- func (s *SplitPane) SetPanes(panes *PaneClients)
- func (s *SplitPane) SetSize(width, height int)
- func (s *SplitPane) SetTerminalHidden(h bool)
- func (s *SplitPane) String() string
- func (s *SplitPane) Terminal() *TerminalPane
- func (s *SplitPane) TerminalTmuxSession() *tmux.TmuxSession
- func (s *SplitPane) ToggleDiff()
- func (s *SplitPane) UpdateAgent(instance *core.InstanceView) error
- func (s *SplitPane) UpdateDiff(instance *core.InstanceView)
- func (s *SplitPane) UpdateTerminal(instance *core.InstanceView) error
- type SubagentRow
- type TabStatus
- type TerminalPane
- func (t *TerminalPane) BeginSelection(row, col int)
- func (t *TerminalPane) ClearSelection()
- func (t *TerminalPane) Close()
- func (t *TerminalPane) CurrentTmuxSession() *tmux.TmuxSession
- func (t *TerminalPane) CursorState() (vt.Cursor, bool)
- func (t *TerminalPane) DetachAll() []*tmux.TmuxSession
- func (t *TerminalPane) DetachExcept(keep map[string]bool) []*tmux.TmuxSession
- func (t *TerminalPane) ExtendSelection(row, col int)
- func (t *TerminalPane) ForwardFocus(in bool)
- func (t *TerminalPane) ForwardMouse(cb, col, row int, press bool) error
- func (t *TerminalPane) GotoBottom()
- func (t *TerminalPane) GotoTop() error
- func (t *TerminalPane) InjectSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
- func (t *TerminalPane) IsScrolling() bool
- func (t *TerminalPane) PageDown() error
- func (t *TerminalPane) PageUp() error
- func (t *TerminalPane) Paste(text string) error
- func (t *TerminalPane) ResetToNormalMode()
- func (t *TerminalPane) ScrollDown() error
- func (t *TerminalPane) ScrollPercent() float64
- func (t *TerminalPane) ScrollUp() error
- func (t *TerminalPane) SelectedText() string
- func (t *TerminalPane) SendKeysRaw(b []byte) error
- func (t *TerminalPane) SendKeysToInstance(title, text string) error
- func (t *TerminalPane) SendPrompt(text string) error
- func (t *TerminalPane) SetSize(width, height int)
- func (t *TerminalPane) ShowingFallback() bool
- func (t *TerminalPane) String() string
- func (t *TerminalPane) UpdateContent(instance *core.InstanceView) error
- type Theme
- type Workbench
- func (w *Workbench) Diff() *DiffPane
- func (w *Workbench) FileUnderCursor() (string, bool)
- func (w *Workbench) FilesBottom()
- func (w *Workbench) FilesDown()
- func (w *Workbench) FilesTop()
- func (w *Workbench) FilesUp()
- func (w *Workbench) Review() ReviewPane
- func (w *Workbench) Root() string
- func (w *Workbench) SessionTitle() string
- func (w *Workbench) SetFiles(root string, paths []string)
- func (w *Workbench) SetReview(p ReviewPane)
- func (w *Workbench) SetSession(title, root string)
- func (w *Workbench) SetSize(width, height int)
- func (w *Workbench) SetTab(t WorkbenchTab)
- func (w *Workbench) String() string
- func (w *Workbench) Tab() WorkbenchTab
- type WorkbenchTab
- type WorkspaceTabBar
Constants ¶
const ( // RailCardLines is lines per DensityRail card incl. trailing gap. RailCardLines = 3 // RailHeaderLines is the section-label header at the top of the rail. RailHeaderLines = 2 )
Rail layout constants (used by List height math).
const ( // ListWidthPercent is the fraction of terminal width allotted to the // left-hand session list. ListWidthPercent = 0.2 // SplitAgentPercent is the fraction of the right-hand pane height // given to the agent view; the terminal pane gets the remainder. SplitAgentPercent = 0.7 // OverlayWidthPercent / OverlayHeightPercent size modal overlays // (text input, confirmation, pickers). OverlayWidthPercent = 0.6 OverlayHeightPercent = 0.4 // PreviewWidthPercent sizes the preview-pane capture column. PreviewWidthPercent = 0.9 )
Layout proportions used across the TUI. Keeping them centralized prevents drift between app.go's sizing math and the component-level calculations.
const ( FocusAgent int = iota FocusTerminal )
FocusAgent and FocusTerminal are the SplitPane focus values: the top (agent) or bottom (terminal) pane. Focus determines which pane receives scroll and attach keypresses.
const DefaultThemeName = "afterglow"
DefaultThemeName is applied at startup when config names no theme (or an unknown one).
const MarkdownMaxBytes = 256 * 1024
MarkdownMaxBytes caps how much of a document is fed to glamour; the tail beyond it is dropped with a truncation notice. Glamour renders synchronously on the Update goroutine (lazily, once per content/width/theme change), so the cap bounds that stall.
const UsageStaleAfter = 4 * time.Minute
UsageStaleAfter is when a usage sample renders dimmed with its age: two of app's 2-minute probe intervals.
Variables ¶
var ( Ground = current.Ground Panel = current.Panel Text = current.Text Dim = current.Dim Faint = current.Faint Rule = current.Rule Accent = current.Accent Attention = current.Attention Highlight = current.Highlight OK = current.OK ErrorColor = current.Error Workspace = current.Workspace Info = current.Info SelectionBg = current.SelectionBg SelectionFg = current.SelectionFg )
Active color roles. Reassigned (main goroutine only: startup, or the settings overlay's Update-goroutine handler) by ApplyTheme.
var (
AdditionStyle, DeletionStyle, HunkStyle lipgloss.Style
)
AdditionStyle, DeletionStyle, and HunkStyle are the lipgloss styles applied line-by-line by colorizeDiff to render a colorized git diff. They are exported so tests and callers composing their own diff renderers can reuse the same palette.
var FallBackText = `` /* 637-byte string literal not displayed */
FallBackText is the ASCII splash rendered in empty-state panes when no instance is selected or a newly created instance has not yet started.
Functions ¶
func AccountUsageText ¶ added in v0.14.0
func AccountUsageText(s AccountStatus, now time.Time) string
AccountUsageText is the plain usage summary: "5h 12% · 7d 31%", plus " · 9m ago" once stale; "logged out"; "n/a" when plan limits don't apply (API-key auth); "—" before the first successful probe.
func AdjustPreviewWidth ¶
AdjustPreviewWidth adjusts the width of the preview pane per PreviewWidthPercent.
func ApplyTheme ¶ added in v0.13.0
ApplyTheme activates the named theme, reassigns every role var, and re-runs all registered hooks. Unknown or empty names activate the default theme and return false. Main-goroutine only.
func ContentTailLines ¶ added in v0.13.0
ContentTailLines is TailLines minus trailing agent chrome. Coding-agent TUIs (Claude Code and friends) pin an input area — delimited by horizontal rules or a box — plus footer lines to the bottom of the screen, so a bottom-anchored tail shows only that chrome and never the conversation. This scans the trailing lines for that shape and anchors the tail above it; a dialog rendered inside the input area (permission prompt) is real content, so its interior is returned instead. Any screen without the shape (shells, aider, half-drawn panes) falls back to the plain TailLines behavior.
func CurrentThemeName ¶ added in v0.13.0
func CurrentThemeName() string
CurrentThemeName returns the active theme's name.
func DisplayIndex ¶ added in v0.3.0
func DisplayIndex(items []core.InstanceView, i int) int
DisplayIndex returns the 1-based number shown in the list UI for the item at position i in items. A leading workspace terminal (position 0) is numbered 0, not 1, so every other item's displayed number is offset by one relative to its slice position. Exported so callers that build a session-index picker from the same items (e.g. the merge picker) label rows with the exact number the user already saw in the main list.
func IsMarkdownPath ¶ added in v0.13.0
IsMarkdownPath reports whether path has a markdown extension.
func MessageTailLines ¶ added in v0.14.0
MessageTailLines returns the last n lines of a message Claude wrote, for a card's tail: blank and code-fence lines are dropped, a heading's leading #s trimmed, and every line sanitized, since the text is model-written. Returns nil when nothing is left or n < 1.
func RegisterThemeHook ¶ added in v0.13.0
func RegisterThemeHook(fn func())
RegisterThemeHook registers fn to rebuild theme-derived styles and invokes it immediately. Call from init() in the file that owns the styles. Main-goroutine only.
func RenderCard ¶ added in v0.13.0
func RenderCard(d CardData, density CardDensity, width int) string
RenderCard renders d at the given density and total width. DensityCard is rendered by Overview (overview.go) which owns border/grid layout; RenderCard handles DensityLine and DensityRail.
func SetShowAccounts ¶ added in v0.14.0
func SetShowAccounts(on bool)
SetShowAccounts turns account badges on or off.
func ShowAccounts ¶ added in v0.14.0
func ShowAccounts() bool
ShowAccounts reports whether account badges are on.
func SortForOverview ¶ added in v0.13.0
func SortForOverview(items []core.InstanceView) []int
SortForOverview returns display order (indices into items) for the overview grid and overview cursor movement: workspace terminal pinned first, then attention > running/loading > ready > paused/recoverable, stable by title within a tier. Deleting sorts last.
func TailLines ¶ added in v0.13.0
TailLines returns the last n non-blank-tail lines of screen with ANSI styling stripped (card chrome owns the styling; embedded SGR would bleed). C0 controls survive ansi.Strip, so tabs are normalized to a single space and carriage returns dropped — emulator output never contains them today, but the helper is exported and generic. Returns nil for an effectively empty screen.
func ThemeNames ¶ added in v0.13.0
func ThemeNames() []string
ThemeNames returns all registered theme names, sorted.
Types ¶
type AccountStatus ¶ added in v0.14.0
type AccountStatus struct {
Name string
// IsDefault marks the account new sessions preselect ("*").
IsDefault bool
// Usage is the last good probe; a zero At means never probed.
Usage account.Usage
// Failing reports that the latest probe failed (Usage is older).
Failing bool
// LoggedOut reports that `claude auth status` said so.
LoggedOut bool
}
AccountStatus is the render-ready view of one Claude account, shared by the usage strip, the Launch Options Account row and the Accounts screen.
type AccountStrip ¶ added in v0.14.0
type AccountStrip struct {
// contains filtered or unexported fields
}
AccountStrip is the one-row usage summary above the workspace tab bar: every Claude account with its 5-hour and weekly plan usage. It shows only when an extra account exists (two or more accounts).
func NewAccountStrip ¶ added in v0.14.0
func NewAccountStrip() *AccountStrip
NewAccountStrip creates an empty (hidden) strip.
func (*AccountStrip) Height ¶ added in v0.14.0
func (s *AccountStrip) Height() int
Height is 1 while the strip shows, else 0.
func (*AccountStrip) SetAccounts ¶ added in v0.14.0
func (s *AccountStrip) SetAccounts(a []AccountStatus)
SetAccounts replaces the accounts shown, default first.
func (*AccountStrip) SetWarning ¶ added in v0.14.0
func (s *AccountStrip) SetWarning(w string)
SetWarning sets a condition that makes the usage misleading, such as a credential in loom's environment that every account runs as; "" clears it. It leads the row, marked "⚠", and at narrow widths the usage is cut before it is. It never shows the strip on its own.
func (*AccountStrip) SetWidth ¶ added in v0.14.0
func (s *AccountStrip) SetWidth(w int)
SetWidth sets the render width.
func (*AccountStrip) String ¶ added in v0.14.0
func (s *AccountStrip) String() string
String renders the strip at the current time; "" when hidden.
type CardData ¶ added in v0.13.0
type CardData struct {
Title string
Index int // 1-based display number (0 for workspace terminal)
Status session.Status
IsWorkspaceTerminal bool
BellPending bool
Selected bool
Branch string
DiffAdded int
DiffRemoved int
HasDiff bool
TailLines []string
StatusAge time.Duration // 0 = unknown/not applicable
Spinner string // current spinner frame for Running/Loading
// WaitReason is Claude's own account of what a Prompting session is
// blocked on ("permission: Bash", "sandbox request"), from its hooks
// or the agent roster, via sanitizeCardText. Empty when unknown —
// non-Claude agents, and any status the pane scraper decided.
WaitReason string
// Subagents lists the session's live subagents and teammates, working
// first, with names and descriptions passed through sanitizeCardText.
// Empty for most cards; see core.InstanceView.Subagents.
Subagents []SubagentRow
// GitHub is the poller's join for this session (issue, PR, checks).
// Known=false renders nothing. See app/github.go.
GitHub github.State
// Ahead/Behind count commits relative to the base branch; HasParity
// is false until a count succeeded.
Ahead, Behind int
HasParity bool
// Account is the Claude account badge ("max-2", "default"); empty when
// badges are off (no extra account) or the session isn't Claude.
Account string
}
CardData is the render-ready view-model for one instance card. It is plain data so RenderCard stays a pure, table-testable function; build it from a live instance with BuildCardData.
func BuildCardData ¶ added in v0.13.0
func BuildCardData(v core.InstanceView, pane Pane, selected bool, spinnerFrame string, tailN int) CardData
BuildCardData snapshots v into a CardData. pane is v's pane (PaneClients.For), and the live tail is read from its in-memory emulator screen, so calling this per visible card per frame forks no subprocesses. Instances on the snapshot path render their status label instead of a tail. spinnerFrame is the current spinner view ("" when unavailable). tailN caps the tail; 0 skips the screen read entirely (DensityLine callers). When Claude's last message is current and the session is not working, the tail is the end of that message instead, on either path.
func (CardData) NeedsAttention ¶ added in v0.13.0
NeedsAttention reports whether this card should carry the Attention accent — the only loud signal in the UI. A Deleting instance never needs attention: a stale bell on a mid-kill card must not paint it gold or float it into the attention tier.
type CardDensity ¶ added in v0.13.0
type CardDensity int
CardDensity selects how much of an instance a card shows.
const ( // DensityLine is a one-line row (height-starved fallback). DensityLine CardDensity = iota // DensityRail is the focus-mode rail mini-card: title line + one // tail/status line, with a left accent bar. DensityRail // DensityCard is the overview card: bordered box with metadata and // a multi-line tail (rendered by Overview in overview.go). DensityCard )
type DiffPane ¶
type DiffPane struct {
// contains filtered or unexported fields
}
DiffPane renders the colorized git diff overlay shown when the user toggles it on with `d`. It caches the last rendered diff content so tick-driven redraws skip re-colorization when the underlying diff has not changed — cheap on every render, noticeable at large diffs.
func NewDiffPane ¶
func NewDiffPane() *DiffPane
NewDiffPane constructs a DiffPane with a zero-sized viewport; the caller must SetSize before the first render.
func (*DiffPane) GotoBottom ¶
func (d *DiffPane) GotoBottom()
GotoBottom jumps the viewport to the end.
func (*DiffPane) PageDown ¶
func (d *DiffPane) PageDown()
PageDown scrolls the viewport down by half a view.
func (*DiffPane) PageUp ¶
func (d *DiffPane) PageUp()
PageUp scrolls the viewport up by half a view.
func (*DiffPane) ScrollPercent ¶
ScrollPercent returns the viewport position as a fraction [0, 1].
func (*DiffPane) SetDiff ¶
func (d *DiffPane) SetDiff(instance *core.InstanceView)
SetDiff replaces the rendered diff from instance's current diff stats. No-ops when the content has not changed since the last call, and shows fallback text for nil / unstarted / errored instances.
type ErrBox ¶
type ErrBox struct {
// contains filtered or unexported fields
}
ErrBox is the bottom-row error surface. It renders a single-line, centered red message and collapses embedded newlines into `//` so multi-line errors still fit one row.
func NewErrBox ¶
func NewErrBox() *ErrBox
NewErrBox constructs an empty ErrBox; the caller must SetSize before the first render.
func (*ErrBox) Clear ¶
func (e *ErrBox) Clear()
Clear removes the currently displayed error and info line immediately.
func (*ErrBox) ExpireIfDue ¶ added in v0.13.0
ExpireIfDue clears the box once its armed deadline has passed. Intended to be called from an existing periodic tick rather than scheduling a timer per message — without this, SetInfo/SetError have no way to expire on their own and a toast lingers on screen indefinitely once shown.
func (*ErrBox) SetError ¶
SetError replaces the currently displayed error and arms its auto-clear deadline (see ExpireIfDue). Pass nil to hide the box on the next render; prefer Clear for clarity.
func (*ErrBox) SetInfo ¶ added in v0.3.0
SetInfo sets a non-error status line (e.g. the recovery summary) and arms its auto-clear deadline, mirroring SetError. An active error takes precedence over info in String().
type GroupState ¶ added in v0.13.0
type GroupState int
GroupState classifies how an overview group renders.
const ( GroupLoaded GroupState = iota // reconciled; render cards GroupEmpty // loaded but no instances )
type InstanceSource ¶ added in v0.14.0
type InstanceSource interface {
Rows() []core.InstanceView
}
InstanceSource supplies the rows a List shows, in display order. In production it is the slot's view store (app's slotRows: the workspace's views with the TUI's overlays), which the model's edits reach; the List only reads it, so adding, removing and replacing rows are edits of the source. Rows' IDs are unique; a draft row has ID 0.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is the left-panel session rail. It owns the selection cursor and viewport scroll offset, and delegates per-item rendering to RenderCard at DensityRail. The list does not spawn goroutines or mutate instances; its rows come from its InstanceSource, as core.InstanceView values.
func NewList ¶
func NewList(spinner *spinner.Model, src InstanceSource) *List
NewList constructs a List showing src's rows, bound to the given spinner.
func (*List) Down ¶
func (l *List) Down()
Down selects the next non-Deleting item in the list. If every item below the cursor is Deleting (or the cursor is already on the last selectable item), selectedIdx stays put.
func (*List) GetInstanceByTitle ¶ added in v0.8.0
func (l *List) GetInstanceByTitle(title string) *core.InstanceView
GetInstanceByTitle returns a copy of the row with the given title, or nil.
func (*List) GetInstances ¶
func (l *List) GetInstances() []core.InstanceView
GetInstances returns all rows in the list
func (*List) GetSelectedInstance ¶
func (l *List) GetSelectedInstance() *core.InstanceView
GetSelectedInstance returns a copy of the currently selected row, or nil when there is none.
func (*List) NumInstances ¶
NumInstances returns the number of instances currently held by the list. Used by GlobalInstanceLimit checks in the app layer before admitting a new instance.
func (*List) PageDown ¶
func (l *List) PageDown()
PageDown jumps the selection down by one visible page, skipping Deleting items.
func (*List) PageUp ¶
func (l *List) PageUp()
PageUp jumps the selection up by one visible page, skipping Deleting items. If every candidate in the target window is Deleting, the cursor stays put.
func (*List) PeerSections ¶ added in v0.13.0
func (l *List) PeerSections() []PeerSection
PeerSections returns the peer-workspace summaries currently set.
func (*List) SelectID ¶ added in v0.14.0
func (l *List) SelectID(id core.InstanceID)
SelectID finds and selects the row with the given ID in the list.
func (*List) SelectedIdx ¶ added in v0.13.0
SelectedIdx returns the current selection index (for jump helpers).
func (*List) SetPanes ¶ added in v0.14.0
func (l *List) SetPanes(panes *PaneClients)
SetPanes sets the registry the list reads its instances' attach clients from.
func (*List) SetPeerSections ¶ added in v0.13.0
func (l *List) SetPeerSections(peers []PeerSection)
SetPeerSections sets the peer-workspace summaries rendered under the rail.
func (*List) SetSelectedInstance ¶
SetSelectedInstance sets the selected index. Noop if the index is out of bounds.
func (*List) SetSessionPreviewSize ¶
SetSessionPreviewSize sets the height and width for the tmux sessions. This makes the stdout line have the correct width and height. It sizes each started, unpaused row's client and probes no tmux session (it used to run a has-session per row): a row with no client has the zero Pane, whose SetPreviewSize does nothing.
func (*List) SetWorkspaceName ¶
SetWorkspaceName sets the workspace name displayed in the title.
func (*List) Up ¶
func (l *List) Up()
Up selects the prev non-Deleting item in the list. If every item above the cursor is Deleting, selectedIdx stays put.
func (*List) WorkspaceName ¶ added in v0.14.0
WorkspaceName returns the workspace name displayed in the title.
type MarkdownPane ¶ added in v0.13.0
type MarkdownPane struct {
// contains filtered or unexported fields
}
MarkdownPane is the workbench's markdown viewer/editor: a glamour-rendered scrollable view with follow/pin semantics and a raw-text textarea edit mode. Not goroutine-safe; Update-goroutine only (renders lazily inside View, same discipline as ScrollModel.AdvanceAndRender).
func NewMarkdownPane ¶ added in v0.13.0
func NewMarkdownPane() *MarkdownPane
func (*MarkdownPane) ApplySaved ¶ added in v0.13.0
func (m *MarkdownPane) ApplySaved(raw string, mtime time.Time)
ApplySaved is called after a successful disk write: adopt the saved content as the new baseline and drop back to the rendered view.
func (*MarkdownPane) CancelEdit ¶ added in v0.13.0
func (m *MarkdownPane) CancelEdit()
func (*MarkdownPane) Clear ¶ added in v0.13.0
func (m *MarkdownPane) Clear()
Clear empties the pane (file deleted / no markdown in tree).
func (*MarkdownPane) EditDirty ¶ added in v0.13.0
func (m *MarkdownPane) EditDirty() bool
func (*MarkdownPane) EditValue ¶ added in v0.13.0
func (m *MarkdownPane) EditValue() string
func (*MarkdownPane) Editing ¶ added in v0.13.0
func (m *MarkdownPane) Editing() bool
func (*MarkdownPane) Following ¶ added in v0.13.0
func (m *MarkdownPane) Following() bool
func (*MarkdownPane) HandleEditKey ¶ added in v0.13.0
func (m *MarkdownPane) HandleEditKey(msg tea.KeyPressMsg)
HandleEditKey forwards a key to the textarea.
func (*MarkdownPane) Mtime ¶ added in v0.13.0
func (m *MarkdownPane) Mtime() time.Time
func (*MarkdownPane) PageDown ¶ added in v0.13.0
func (m *MarkdownPane) PageDown()
func (*MarkdownPane) PageUp ¶ added in v0.13.0
func (m *MarkdownPane) PageUp()
func (*MarkdownPane) Path ¶ added in v0.13.0
func (m *MarkdownPane) Path() string
func (*MarkdownPane) Scroll ¶ added in v0.13.0
func (m *MarkdownPane) Scroll() int
func (*MarkdownPane) ScrollBottom ¶ added in v0.13.0
func (m *MarkdownPane) ScrollBottom()
func (*MarkdownPane) ScrollDown ¶ added in v0.13.0
func (m *MarkdownPane) ScrollDown()
func (*MarkdownPane) ScrollTop ¶ added in v0.13.0
func (m *MarkdownPane) ScrollTop()
func (*MarkdownPane) ScrollUp ¶ added in v0.13.0
func (m *MarkdownPane) ScrollUp()
func (*MarkdownPane) SetDocument ¶ added in v0.13.0
func (m *MarkdownPane) SetDocument(path, raw string, mtime time.Time)
SetDocument replaces the shown document. A path change resets scroll; a same-path reload (follow refresh) preserves it, clamped.
func (*MarkdownPane) SetFollowing ¶ added in v0.13.0
func (m *MarkdownPane) SetFollowing(f bool)
func (*MarkdownPane) SetSize ¶ added in v0.13.0
func (m *MarkdownPane) SetSize(width, height int)
func (*MarkdownPane) StartEdit ¶ added in v0.13.0
func (m *MarkdownPane) StartEdit() bool
StartEdit flips to the raw-text editor seeded with the loaded content. Returns false when there is nothing to edit.
func (*MarkdownPane) View ¶ added in v0.13.0
func (m *MarkdownPane) View() string
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu is the bottom-row keybinding hint strip. It reads GlobalkeyBindings to render labels and tracks the most recent keypress so the UI can momentarily underline the matching entry for visual feedback.
func NewMenu ¶
func NewMenu() *Menu
NewMenu constructs a Menu in StateEmpty with no active keypress. The caller must SetSize before the first render.
func (*Menu) ClearKeydown ¶
func (m *Menu) ClearKeydown()
ClearKeydown removes any active key-press highlight.
func (*Menu) Instance ¶ added in v0.13.0
func (m *Menu) Instance() *core.InstanceView
Instance returns the instance the menu was last pointed at (nil for none).
func (*Menu) Keydown ¶
Keydown marks name as the most recently pressed key so the next render underlines its menu entry. ClearKeydown resets this.
func (*Menu) SetInstance ¶
func (m *Menu) SetInstance(instance *core.InstanceView)
SetInstance updates the current instance and refreshes menu options. It keeps the copy it is given, so a change to the instance reaches the menu only through another SetInstance.
func (*Menu) SetSize ¶
SetSize sets the width of the window. The menu will be centered horizontally within this width.
type Overview ¶ added in v0.13.0
type Overview struct {
// contains filtered or unexported fields
}
Overview renders the triage card grid: every open workspace group's instances as bordered cards under a collapsible group header, with empty groups rendered inline. The render cursor spans groups (OverviewCursor{Group,Item}).
func NewOverview ¶ added in v0.13.0
func NewOverview() *Overview
NewOverview constructs an empty overview component.
func (*Overview) IsCollapsed ¶ added in v0.13.0
IsCollapsed reports a group's collapsed state.
func (*Overview) Render ¶ added in v0.13.0
func (o *Overview) Render(d OverviewData) string
Render draws the multi-group fleet overview. Height is hard-clamped; the combined vertical window (Task 7) keeps the cursor group/card visible.
func (*Overview) ToggleCollapse ¶ added in v0.13.0
ToggleCollapse flips a group's collapsed state (case-insensitive name).
type OverviewCursor ¶ added in v0.13.0
OverviewCursor is the render-space selection: a group index into Groups and an item position within that group's Order.
type OverviewData ¶ added in v0.13.0
type OverviewData struct {
Groups []OverviewGroup
Cursor OverviewCursor
Spinner string
// Panes resolves each card's attach client for its tail.
Panes *PaneClients
}
OverviewData is everything Render needs, assembled by the app on the Update goroutine each frame (same pattern as List reading instances).
type OverviewGroup ¶ added in v0.13.0
type OverviewGroup struct {
Name string
Items []core.InstanceView
Order []int // SortForOverview(Items); empty when the group is empty
State GroupState
}
OverviewGroup is one open workspace's slice of the overview.
type Pane ¶ added in v0.14.0
type Pane struct {
// contains filtered or unexported fields
}
Pane is one agent pane's display surface. It covers its attach client's screen, scroll-back and cursor, input forwarded through the client's PTY, and the status scrape that reads the screen. The zero value has no client: the instance is not started, is paused, or has none attached yet. It answers every read with a zero value and every forward with nil, just as the instance's own guards did for an instance with no live pane.
func (Pane) Attached ¶ added in v0.14.0
Attached reports whether the pane's client is attached: its PTY is open and its pump still reads the session (tmux.TmuxSession.Attached). The health tick and the Dead path repair a live session's pane that is not.
func (Pane) CaptureHistory ¶ added in v0.14.0
CaptureHistory returns the pane's tmux buffer (scroll-back plus screen) for windowing on the snapshot path, or ("", false).
func (Pane) Client ¶ added in v0.14.0
func (p Pane) Client() *tmux.TmuxSession
Client returns the pane's attach client, or nil.
func (Pane) CursorState ¶ added in v0.14.0
CursorState returns the pane's live cursor, or ok=false.
func (Pane) DetectStatus ¶ added in v0.14.0
DetectStatus runs one status scan of the pane's screen (see tmux.TmuxSession.DetectStatus). Without a client there is no screen to scan and it returns zeros, which are no opinion, not "settled, no prompt": callers skip a pane whose Client is nil.
func (Pane) EmulatorScreen ¶ added in v0.14.0
EmulatorScreen returns the emulator's visible screen without running a subprocess, which makes it cheap enough to call for every visible card each frame. ok is false without an emulator (snapshot path) or a client.
func (Pane) ForwardFocus ¶ added in v0.14.0
ForwardFocus forwards a focus in/out event when the agent has asked for them. It is best-effort: a failure is logged.
func (Pane) ForwardMouse ¶ added in v0.14.0
ForwardMouse forwards one SGR mouse event at (col,row). Without a live session it does nothing.
func (Pane) ForwardWheel ¶ added in v0.14.0
ForwardWheel forwards n wheel events so a TUI agent scrolls its own view. Without a live session it does nothing.
func (Pane) GetContentHash ¶ added in v0.14.0
GetContentHash returns the hash of the screen that the last status scan saw.
func (Pane) HasEmulator ¶ added in v0.14.0
HasEmulator reports whether the pane renders through the in-process emulator, the event-driven path.
func (Pane) IsAlternateScreen ¶ added in v0.14.0
IsAlternateScreen reports whether the agent is a full-screen TUI on the alternate screen. Such an agent's scroll-back must be forwarded as wheel events.
func (Pane) PaneTitle ¶ added in v0.14.0
PaneTitle returns the window title the agent set via OSC, or ok=false.
func (Pane) Paste ¶ added in v0.14.0
Paste sends text as a bracketed paste. Without a live session it does nothing.
func (Pane) Preview ¶ added in v0.14.0
Preview returns the pane's visible screen: the emulator's, or capture-pane's on the snapshot path. It is empty, with no error, when there is no live session.
func (Pane) SendKeysRaw ¶ added in v0.14.0
SendKeysRaw writes raw key bytes through the client's PTY. Inline attach uses it.
func (Pane) SetPreviewSize ¶ added in v0.14.0
SetPreviewSize resizes the pane's client, and with it the session's window. Without a client it does nothing; Ensure attaches at the default size.
type PaneClients ¶ added in v0.14.0
type PaneClients struct {
// contains filtered or unexported fields
}
PaneClients holds the TUI's attach clients: one *tmux.TmuxSession per live agent tmux session, keyed by the session's name. Each client is attached by name rather than owned by the session's instance. Every pane render, scroll, cursor, mouse, paste and key forward goes through a client here (Pane), and so does the status scrape that reads a pane's screen. That is why session lifecycle never needs a client of its own.
Safe for concurrent use: Get and For may be called from Cmd goroutines. Ensure and Replace attach (a PTY spawn and a capture-pane), and they run on the Update goroutine as the attach paths before them did. A client that Replace or Retain hands back must be closed off the Update goroutine: PausePreview waits for the client's output pump, which blocks in tea.Program.Send until Update returns. Every method except the …ForTest helpers is nil-receiver safe; a nil registry holds no clients.
func NewPaneClients ¶ added in v0.14.0
func NewPaneClients() *PaneClients
NewPaneClients returns an empty registry whose clients attach through the production PTY factory and executor.
func (*PaneClients) Alive ¶ added in v0.14.0
func (p *PaneClients) Alive(sessionName string) bool
Alive reports whether sessionName has an attached client: its PTY is open and its pump still reads the session (tmux.TmuxSession.Attached).
func (*PaneClients) Ensure ¶ added in v0.14.0
func (p *PaneClients) Ensure(sessionName, program string) error
Ensure gives sessionName a client attached at the default size. If the session has no client, Ensure builds and attaches one. If its client is not attached (a failed attach, one paused for a full-screen attach, or one whose pump hit EOF when its session ended, even if a new session of the same name runs now), Ensure re-attaches it, the same object. Its Restore never waits on a live pump: a client whose PTY is gone has no pump left, and an exited pump marks itself only as it returns. An attached client is left alone, and so, for quickExitHoldoff after Ensure attached it, is one whose pump exited on its own: that attach failed at once, and the health tick retries it. program selects a new client's agent adapter for its status scan. The client stays registered even when attaching fails, so a later Ensure retries it. Update goroutine only.
func (*PaneClients) For ¶ added in v0.14.0
func (p *PaneClients) For(v *core.InstanceView) Pane
For returns v's pane: its session's client here, when v is started and not paused; otherwise the zero Pane (also for nil).
func (*PaneClients) Get ¶ added in v0.14.0
func (p *PaneClients) Get(sessionName string) *tmux.TmuxSession
Get returns sessionName's client, or nil.
func (*PaneClients) InjectForTest ¶ added in v0.14.0
func (p *PaneClients) InjectForTest(sessionName string, c *tmux.TmuxSession)
InjectForTest registers c as sessionName's client, as Ensure would have. Test-only, like SetClientFactoryForTest.
func (*PaneClients) Replace ¶ added in v0.14.0
func (p *PaneClients) Replace(sessionName, program string) (*tmux.TmuxSession, error)
Replace gives sessionName a fresh client. It is for a session just (re)launched under that name, whose previous client was watching the session it replaced. The old client, if any, is returned for the caller to close off the Update goroutine. Update goroutine only.
func (*PaneClients) Retain ¶ added in v0.14.0
func (p *PaneClients) Retain(keep map[string]bool) []*tmux.TmuxSession
Retain drops every client whose session name is not in keep and returns them for the caller to close off the Update goroutine.
func (*PaneClients) SetClientFactoryForTest ¶ added in v0.14.0
func (p *PaneClients) SetClientFactoryForTest(f func(sessionName, program string) *tmux.TmuxSession)
SetClientFactoryForTest replaces how new clients are built, so that a test's Ensure/Replace attach through a fake PTY. Test-only: the name and doc comment are guardrails; nothing about the method enforces test-only use.
func (*PaneClients) SetClockForTest ¶ added in v0.14.0
func (p *PaneClients) SetClockForTest(now func() time.Time)
SetClockForTest replaces the clock Ensure times attaches by, so a test can step past quickExitHoldoff without sleeping. Test-only, like SetClientFactoryForTest.
func (*PaneClients) SetDefaultSize ¶ added in v0.14.0
func (p *PaneClients) SetDefaultSize(cols, rows int)
SetDefaultSize records the agent pane size that clients attach at.
type PeerSection ¶ added in v0.13.0
type PeerSection struct {
Name string
Attention int // Prompting or bell-pending
Running int // Running/Loading
Idle int // everything else
}
PeerSection summarizes a non-focused workspace slot for the rail footer (live counts from that slot's list; selection stays scoped to the focused workspace until cross-workspace lands).
type PreviewPane ¶
type PreviewPane struct {
// contains filtered or unexported fields
}
PreviewPane renders the agent tmux pane's content in the top half of the split view. It tails the emulator's live screen at the live tail, and when scrolled windows the emulator's scrollback in-process (ScrollModel); on the no-emulator path (snapshot mode / Windows) it paints a window into tmux's authoritative history (capture-pane -S -) via snapFallback. Either way live output keeps flowing. lastInstanceTitle resets the scroll position on selection change rather than persisting a stale offset.
func NewPreviewPane ¶
func NewPreviewPane() *PreviewPane
NewPreviewPane constructs a PreviewPane at live tail; the caller must SetSize before the first render.
func (*PreviewPane) BeginSelection ¶ added in v0.3.0
func (p *PreviewPane) BeginSelection(row, col int)
BeginSelection starts a selection anchored at content (row, col).
func (*PreviewPane) ClearSelection ¶ added in v0.3.0
func (p *PreviewPane) ClearSelection()
ClearSelection clears any active selection.
func (*PreviewPane) ExtendSelection ¶ added in v0.3.0
func (p *PreviewPane) ExtendSelection(row, col int)
ExtendSelection moves the active selection's cursor to content (row, col).
func (*PreviewPane) GotoBottom ¶
func (p *PreviewPane) GotoBottom(instance *core.InstanceView) error
GotoBottom returns to the live tail (TUI: a large wheel-down burst).
func (*PreviewPane) GotoTop ¶
func (p *PreviewPane) GotoTop(instance *core.InstanceView) error
GotoTop jumps to the oldest line of captured history (TUI: a large wheel-up burst).
func (*PreviewPane) IsScrolling ¶
func (p *PreviewPane) IsScrolling() bool
IsScrolling reports whether the pane is scrolled away from the live tail.
func (*PreviewPane) PageDown ¶
func (p *PreviewPane) PageDown(instance *core.InstanceView) error
PageDown scrolls down by half a pane height (or forwards a burst of wheel-downs).
func (*PreviewPane) PageUp ¶
func (p *PreviewPane) PageUp(instance *core.InstanceView) error
PageUp scrolls up by half a pane height (or forwards a burst of wheel-ups).
func (*PreviewPane) ResetToNormalMode ¶
func (p *PreviewPane) ResetToNormalMode(instance *core.InstanceView) error
ResetToNormalMode returns the pane to the live tail on both paths.
func (*PreviewPane) ScrollDown ¶
func (p *PreviewPane) ScrollDown(instance *core.InstanceView) error
ScrollDown scrolls one line down toward the live tail (or forwards a damped wheel-down).
func (*PreviewPane) ScrollPercent ¶
func (p *PreviewPane) ScrollPercent() float64
ScrollPercent returns the scroll position as a fraction [0, 1]; 1.0 == live tail (bottom).
func (*PreviewPane) ScrollUp ¶
func (p *PreviewPane) ScrollUp(instance *core.InstanceView) error
ScrollUp scrolls one line up into history (or forwards a damped wheel-up to a TUI agent).
func (*PreviewPane) SelectedText ¶ added in v0.3.0
func (p *PreviewPane) SelectedText() string
SelectedText returns the currently selected text (plain), or "" if none.
func (*PreviewPane) SetPanes ¶ added in v0.14.0
func (p *PreviewPane) SetPanes(panes *PaneClients)
SetPanes sets the registry the pane reads its instance's attach client from.
func (*PreviewPane) SetSize ¶
func (p *PreviewPane) SetSize(width, maxHeight int)
SetSize records the pane dimensions. maxHeight caps the visible height — content exceeding it is truncated with an ellipsis at live tail or windowed when scrolled.
func (*PreviewPane) ShowingFallback ¶ added in v0.8.0
func (p *PreviewPane) ShowingFallback() bool
ShowingFallback reports whether the pane is displaying splash/fallback text instead of live terminal content (no cursor applies there).
func (*PreviewPane) String ¶
func (p *PreviewPane) String() string
Returns the preview pane content as a string.
func (*PreviewPane) UpdateContent ¶
func (p *PreviewPane) UpdateContent(instance *core.InstanceView) error
UpdateContent refreshes the pane from the given instance. At the live tail it tails the live emulator screen; when scrolled it windows the emulator's scrollback in-process (ScrollModel), or, on the no-emulator path, tmux's authoritative history (capture-pane -S -) at the current offset, anchoring the view to its content as live output accrues below. Falls back to splash text for nil/loading/paused instances and resets the offset on instance change.
type QuickInputAction ¶
type QuickInputAction int
QuickInputAction represents the result of handling a key press in the input bar.
const ( QuickInputContinue QuickInputAction = iota QuickInputSubmit QuickInputCancel )
QuickInputContinue, QuickInputSubmit, and QuickInputCancel are the terminal states HandleKey returns so the parent model knows whether to keep the bar open, dispatch the contents, or dismiss the bar.
type QuickInputBar ¶
type QuickInputBar struct {
Target QuickInputTarget
// contains filtered or unexported fields
}
QuickInputBar is a single-line input bar for quick interactions with tmux sessions.
func NewQuickInputBar ¶
func NewQuickInputBar(target QuickInputTarget) *QuickInputBar
NewQuickInputBar creates a focused input bar ready for typing.
func (*QuickInputBar) HandleKeyPress ¶
func (q *QuickInputBar) HandleKeyPress(msg tea.KeyPressMsg) QuickInputAction
HandleKeyPress processes a key event and returns the resulting action.
func (*QuickInputBar) Height ¶
func (q *QuickInputBar) Height() int
Height returns the number of lines the input bar occupies.
func (*QuickInputBar) SetWidth ¶
func (q *QuickInputBar) SetWidth(w int)
SetWidth sets the rendering width of the input bar.
func (*QuickInputBar) Value ¶
func (q *QuickInputBar) Value() string
Value returns the current text in the input bar.
type QuickInputTarget ¶
type QuickInputTarget int
QuickInputTarget specifies where submitted text should be routed.
const ( QuickInputTargetAgent QuickInputTarget = iota QuickInputTargetTerminal )
QuickInputTargetAgent sends submitted text to the agent pane; the terminal variant routes to the bottom pane. The target is chosen at construction time and is immutable for the life of the bar.
type ReviewPane ¶ added in v0.13.0
ReviewPane is the workbench's view of the review panel. The concrete *reviewui.Pane lives in the app layer: ui/review imports ui for theme roles, so package ui must not import it back.
type ScrollModel ¶ added in v0.13.0
type ScrollModel struct {
// contains filtered or unexported fields
}
ScrollModel owns pane scroll state for the emulator path: the lines-from-bottom offset, output anchoring, the new-lines-below footer count, wheel damping, and alt-screen routing. Both panes embed one. All methods run on the Update goroutine (no locking; TerminalPane's own mutex wraps its calls).
func (*ScrollModel) AdvanceAndRender ¶ added in v0.13.0
func (m *ScrollModel) AdvanceAndRender(src scrollSource, rows int) (window string, live bool, ok bool)
AdvanceAndRender renders `rows` lines at the current offset. live=true means the pane is at the live tail (offset 0) and the caller should render its normal live view instead. ok=false means no emulator (snapshot fallback).
It also performs the per-render anchoring bump and clamping (hence the name — it advances the anchor state AND renders), so it must be called exactly once per render pass. A repeat call with no intervening output is idempotent: sbLen is unchanged so the anchor bump is a no-op and the window is identical. The only failure mode of an extra call is NewLinesBelow drift if output *did* arrive between the two calls — never corruption of the rendered window.
Limitation: at the emulator's scrollback cap (x/vt default 10k lines) sbLen plateaus, so the anchor bump stops compensating for further scroll-off and the view drifts up by at most the overflow. Bounded, graceful degradation — accepted.
func (*ScrollModel) GotoTop ¶ added in v0.13.0
func (m *ScrollModel) GotoTop(src scrollSource)
GotoTop pins the view to the oldest line (clamped in Window).
func (*ScrollModel) IsScrolling ¶ added in v0.13.0
func (m *ScrollModel) IsScrolling() bool
IsScrolling reports whether the pane is away from the live tail.
func (*ScrollModel) NeedsAltProbe ¶ added in v0.13.0
func (m *ScrollModel) NeedsAltProbe() bool
NeedsAltProbe reports whether the alt-screen TTL cache is stale, i.e. the next isAltScreen would run a subprocess probe. It only reads cache timestamps, so a caller holding its own mutex can consult it, drop the mutex, run the probe (IsAlternateScreen — a tmux subprocess) off-lock, then SetAltProbe the result before invoking a routing method. That keeps the subprocess out of the caller's lock while a subsequent route()/PageUp on the now-fresh cache never re-probes. Used by TerminalPane, whose t.mu wraps all ScrollModel access; PreviewPane is unlocked and calls the routers directly.
func (*ScrollModel) NewLinesBelow ¶ added in v0.13.0
func (m *ScrollModel) NewLinesBelow() int
NewLinesBelow is the footer count: scroll-off lines accrued since the gesture began. Limitation: at the scrollback cap (x/vt default 10k lines) sbLen plateaus, so the count stops growing even as new output arrives — bounded, graceful degradation, accepted.
func (*ScrollModel) PageDown ¶ added in v0.13.0
func (m *ScrollModel) PageDown(src scrollSource, height int) error
func (*ScrollModel) PageUp ¶ added in v0.13.0
func (m *ScrollModel) PageUp(src scrollSource, height int) error
PageUp/PageDown move by half the given pane height (or forward a burst).
func (*ScrollModel) Reset ¶ added in v0.13.0
func (m *ScrollModel) Reset()
Reset returns to the live tail (resize, instance switch, Esc/End) and forces the next alt-screen probe.
func (*ScrollModel) ScrollBy ¶ added in v0.13.0
func (m *ScrollModel) ScrollBy(src scrollSource, delta int)
ScrollBy moves the offset by delta (positive = up into history). The gesture baseline is captured on the first move away from the tail.
func (*ScrollModel) ScrollDown ¶ added in v0.13.0
func (m *ScrollModel) ScrollDown(src scrollSource) error
func (*ScrollModel) ScrollPercent ¶ added in v0.13.0
func (m *ScrollModel) ScrollPercent(src scrollSource) float64
ScrollPercent maps the offset to [0,1]; 1.0 = live tail.
func (*ScrollModel) ScrollUp ¶ added in v0.13.0
func (m *ScrollModel) ScrollUp(src scrollSource) error
ScrollUp/ScrollDown route one wheel/key tick: alt-screen TUIs get damped forwarded wheel events; everything else moves the window.
func (*ScrollModel) SetAltProbe ¶ added in v0.13.0
func (m *ScrollModel) SetAltProbe(alt bool)
SetAltProbe stores a freshly-probed alt-screen result and stamps the TTL, so the next isAltScreen within agentScrollTTL is a cache hit. Pairs with NeedsAltProbe for off-lock probing (see there).
type SplitPane ¶
type SplitPane struct {
// contains filtered or unexported fields
}
SplitPane composes the right-hand side of the TUI: an agent preview on top, a terminal pane below (split by the adjustable agentRatio, default SplitAgentPercent; the terminal pane can be hidden entirely), and a hotkey-toggled diff overlay that replaces both. SplitPane holds the currently-focused pane index and inline-attach flag but does not own scroll state — each child pane manages its own viewport.
func NewSplitPane ¶
func NewSplitPane(agent *PreviewPane, diff *DiffPane, terminal *TerminalPane) *SplitPane
NewSplitPane wires the three child panes into a SplitPane with the agent pane focused by default. The caller retains ownership of the child panes; SplitPane borrows them for routing.
func (*SplitPane) AdjustAgentRatio ¶ added in v0.13.0
AdjustAgentRatio nudges the split by delta and returns the new ratio.
func (*SplitPane) AgentContentHeight ¶ added in v0.13.0
AgentContentHeight is the agent pane's inner height — the app's mouse hit-test anchor mirrors layout through this instead of duplicating the math.
func (*SplitPane) AgentRatio ¶ added in v0.13.0
AgentRatio returns the agent pane's height share (default SplitAgentPercent when unset).
func (*SplitPane) BeginSelection ¶ added in v0.3.0
BeginSelection starts a selection on the given content pane (clearing any selection on the other pane first).
func (*SplitPane) ClearSelections ¶ added in v0.3.0
func (s *SplitPane) ClearSelections()
ClearSelections clears the selection on both content panes.
func (*SplitPane) CurrentTerminalSessionName ¶ added in v0.8.0
CurrentTerminalSessionName returns the tmux session name backing the currently displayed terminal pane, or "" if none — the key pane events are routed by.
func (*SplitPane) CursorScreenPosition ¶ added in v0.8.0
func (s *SplitPane) CursorScreenPosition(instance *core.InstanceView) (x, y int, cur vt.Cursor, ok bool)
CursorScreenPosition returns the focused pane's live cursor as split-local coordinates plus its full state, or ok=false whenever no hardware cursor should be shown: diff overlay up, focused pane scrolled off the live tail or showing fallback text, no emulator-backed session, cursor hidden (DECTCEM), or the cell out of the pane's bounds.
func (*SplitPane) ExtendSelection ¶ added in v0.3.0
ExtendSelection moves the active selection's cursor on the given content pane.
func (*SplitPane) ForwardTerminalFocus ¶ added in v0.8.0
ForwardTerminalFocus forwards a focus event to the terminal pane's session.
func (*SplitPane) ForwardTerminalMouse ¶ added in v0.3.0
ForwardTerminalMouse forwards one SGR mouse event to the terminal pane's session.
func (*SplitPane) GetAgentSize ¶
GetAgentSize returns the current width and height of the agent pane, primarily used by the attach flow to size the PTY before handing it to the user.
func (*SplitPane) GetFocusedPane ¶
GetFocusedPane returns the currently focused pane constant.
func (*SplitPane) GotoBottom ¶
func (s *SplitPane) GotoBottom()
GotoBottom jumps the active pane to the live tail, exiting scroll mode.
func (*SplitPane) GotoTop ¶
func (s *SplitPane) GotoTop()
GotoTop jumps the active pane to the start of its scrollback.
func (*SplitPane) HitTest ¶ added in v0.3.0
HitTest maps split-pane-local coordinates (x relative to the split's left edge, y from the top of the split) to a content pane and (row, col) within it. Returns ok=false for the diff overlay, borders, the title/bottom-border rows, or coordinates outside any content area. The returned pane is FocusAgent or FocusTerminal. Geometry mirrors renderPane: each box is a title row, a body bordered left/right/bottom (no top), stacked agent-over-terminal.
func (*SplitPane) InjectTerminalSessionForTest ¶ added in v0.6.0
func (s *SplitPane) InjectTerminalSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
InjectTerminalSessionForTest installs ts as the cached terminal session for the given instance title, bypassing the terminal pane's normal lazy-spawn path. Test-only: the name and doc comment are guardrails, nothing about the method enforces test-only use.
func (*SplitPane) Instance ¶ added in v0.13.0
func (s *SplitPane) Instance() *core.InstanceView
Instance returns the instance set by SetInstance (nil for none).
func (*SplitPane) IsAgentInScrollMode ¶
IsAgentInScrollMode returns true if the agent pane is scrolled away from the live tail.
func (*SplitPane) IsDiffVisible ¶
IsDiffVisible returns true if the diff overlay is currently shown.
func (*SplitPane) IsTerminalHidden ¶ added in v0.13.0
IsTerminalHidden reports whether the terminal pane is hidden.
func (*SplitPane) IsTerminalInScrollMode ¶
IsTerminalInScrollMode returns true if the terminal pane is in scroll mode.
func (*SplitPane) PageDown ¶
func (s *SplitPane) PageDown()
PageDown scrolls the active pane down by half a view.
func (*SplitPane) PageTerminalDown ¶
func (s *SplitPane) PageTerminalDown()
PageTerminalDown pages the terminal pane explicitly.
func (*SplitPane) PageTerminalUp ¶
func (s *SplitPane) PageTerminalUp()
PageTerminalUp pages the terminal pane explicitly.
func (*SplitPane) PageUp ¶
func (s *SplitPane) PageUp()
PageUp scrolls the active pane (diff if visible, else focused) up by half a view.
func (*SplitPane) PasteTerminal ¶ added in v0.3.0
PasteTerminal sends text to the terminal pane's session as a bracketed paste.
func (*SplitPane) ResetAgentToNormalMode ¶
func (s *SplitPane) ResetAgentToNormalMode(instance *core.InstanceView) error
ResetAgentToNormalMode resets the agent pane to normal mode.
func (*SplitPane) ResetTerminalToNormalMode ¶
func (s *SplitPane) ResetTerminalToNormalMode()
ResetTerminalToNormalMode exits scroll mode on the terminal pane.
func (*SplitPane) ScrollAgentDown ¶
func (s *SplitPane) ScrollAgentDown()
ScrollAgentDown scrolls the agent pane explicitly (mouse wheel).
func (*SplitPane) ScrollAgentUp ¶
func (s *SplitPane) ScrollAgentUp()
ScrollAgentUp scrolls the agent pane explicitly, ignoring focus/diff (mouse wheel).
The explicit scrollers re-render their pane themselves: a scroll only moves the ScrollModel offset, and the displayed text is rebuilt by UpdateContent. The keyboard path gets that refresh for free from handleScriptDone → instanceChanged, but the wheel handler calls nothing else, so without this the pane sat frozen at the old window until the agent's next output event (or a stray keypress) happened to redraw it.
func (*SplitPane) ScrollDiffDown ¶
func (s *SplitPane) ScrollDiffDown()
ScrollDiffDown scrolls the diff overlay explicitly (no-op if not visible).
func (*SplitPane) ScrollDiffUp ¶
func (s *SplitPane) ScrollDiffUp()
ScrollDiffUp scrolls the diff overlay explicitly (no-op if not visible).
func (*SplitPane) ScrollDown ¶
func (s *SplitPane) ScrollDown()
ScrollDown is the counterpart of ScrollUp; see ScrollUp for routing and error-handling rules.
func (*SplitPane) ScrollTerminalDown ¶
func (s *SplitPane) ScrollTerminalDown()
ScrollTerminalDown scrolls the terminal pane explicitly (mouse wheel).
func (*SplitPane) ScrollTerminalUp ¶
func (s *SplitPane) ScrollTerminalUp()
ScrollTerminalUp scrolls the terminal pane explicitly (mouse wheel). Re-renders for the same reason as ScrollAgentUp.
func (*SplitPane) ScrollUp ¶
func (s *SplitPane) ScrollUp()
ScrollUp scrolls the active pane up by one line. Routing order: diff overlay (when visible) beats the focused pane. Scroll errors are logged rather than propagated because scroll is a view-only operation and should not abort the caller's update cycle.
func (*SplitPane) SelectedText ¶ added in v0.3.0
SelectedText returns the selected text of the given content pane.
func (*SplitPane) SendTerminalKeysRaw ¶
SendTerminalKeysRaw writes raw bytes to the terminal pane's tmux PTY.
func (*SplitPane) SendTerminalKeysToInstance ¶ added in v0.1.2
SendTerminalKeysToInstance sends text followed by Enter to the named instance's cached terminal session. Unlike SendTerminalPrompt, this does not require the instance to be currently displayed.
func (*SplitPane) SendTerminalPrompt ¶
SendTerminalPrompt sends text followed by Enter to the terminal pane's tmux session.
func (*SplitPane) SetAgentRatio ¶ added in v0.13.0
SetAgentRatio sets the agent share (clamped to [0.2, 0.9]) and re-lays-out at the current size. The ratio is snapped to two decimals so repeated ±delta nudges don't accumulate float drift (0.7+0.1 = 0.7999… would truncate a row short in SetSize).
func (*SplitPane) SetFocusedPane ¶
SetFocusedPane sets focus to the specified pane.
func (*SplitPane) SetInlineAttach ¶
SetInlineAttach toggles whether inline-attach mode is active, controlling whether the focused-pane highlight is rendered.
func (*SplitPane) SetInstance ¶
func (s *SplitPane) SetInstance(instance *core.InstanceView)
SetInstance sets the instance whose state the child panes will render on the next UpdateAgent/UpdateDiff/UpdateTerminal call. The child panes read their content from the instance, so switching here without calling the Update* methods leaves the previously-rendered content in place until the next tick. The pane keeps the copy it is given: a change to the instance reaches it (the agent pane's title, the scroll paths) only through another SetInstance.
func (*SplitPane) SetPanes ¶ added in v0.14.0
func (s *SplitPane) SetPanes(panes *PaneClients)
SetPanes sets the registry the agent pane and the hardware cursor read attach clients from.
func (*SplitPane) SetSize ¶
SetSize recomputes the agent/terminal split (per AgentRatio, or all agent when the terminal is hidden) for the given container dimensions and propagates widths to every child pane, including the diff overlay which uses the full inner height.
func (*SplitPane) SetTerminalHidden ¶ added in v0.13.0
SetTerminalHidden shows/hides the terminal pane; hidden gives the agent pane the full height.
func (*SplitPane) Terminal ¶ added in v0.13.0
func (s *SplitPane) Terminal() *TerminalPane
Terminal exposes the terminal child pane so workbench mode can render/size the same TerminalPane instance in its right panel. Ordering contract: in workbench mode the app calls SplitPane.SetSize (which, with the terminal hidden, sizes it to zero) BEFORE Workbench.SetSize re-sizes it for the panel — keep that order.
func (*SplitPane) TerminalTmuxSession ¶
func (s *SplitPane) TerminalTmuxSession() *tmux.TmuxSession
TerminalTmuxSession returns the live tmux session backing the currently displayed terminal pane, or nil if none exists. Callers use this to drive a full-screen attach via tea.ExecProcess.
func (*SplitPane) ToggleDiff ¶
func (s *SplitPane) ToggleDiff()
ToggleDiff shows or hides the diff overlay.
func (*SplitPane) UpdateAgent ¶
func (s *SplitPane) UpdateAgent(instance *core.InstanceView) error
UpdateAgent updates the agent (preview) pane content. Always updates since it's always visible.
func (*SplitPane) UpdateDiff ¶
func (s *SplitPane) UpdateDiff(instance *core.InstanceView)
UpdateDiff updates the diff pane content. Only updates when the overlay is visible.
func (*SplitPane) UpdateTerminal ¶
func (s *SplitPane) UpdateTerminal(instance *core.InstanceView) error
UpdateTerminal updates the terminal pane content. It intentionally keeps updating while the pane is hidden so the content stays warm for an instant unhide.
type SubagentRow ¶ added in v0.13.0
SubagentRow is one live subagent or teammate shown on a card.
type TabStatus ¶
type TabStatus int
TabStatus represents the highest-priority instance status within a workspace tab. Precedence (high→low): Prompting > Running > Ready > Loading > Paused > None.
const ( TabStatusNone TabStatus = iota TabStatusPaused TabStatusLoading TabStatusReady TabStatusRunning TabStatusPrompting )
TabStatusNone through TabStatusPrompting rank an instance status by display priority. A tab aggregates statuses by taking the max across its instances so the most urgent one shows through in the tab dot.
type TerminalPane ¶
type TerminalPane struct {
// contains filtered or unexported fields
}
TerminalPane manages shell tmux sessions in the worktree directory of selected instances. Sessions are cached per instance so switching between instances preserves terminal state.
func NewTerminalPane ¶
func NewTerminalPane() *TerminalPane
NewTerminalPane constructs a TerminalPane with an empty session cache at the live tail. The caller must SetSize before the first render and feed instances via UpdateContent.
func (*TerminalPane) BeginSelection ¶ added in v0.3.0
func (t *TerminalPane) BeginSelection(row, col int)
BeginSelection starts a selection anchored at content (row, col).
func (*TerminalPane) ClearSelection ¶ added in v0.3.0
func (t *TerminalPane) ClearSelection()
ClearSelection clears any active selection.
func (*TerminalPane) Close ¶
func (t *TerminalPane) Close()
Close kills all cached terminal tmux sessions and cleans up.
func (*TerminalPane) CurrentTmuxSession ¶
func (t *TerminalPane) CurrentTmuxSession() *tmux.TmuxSession
CurrentTmuxSession returns the cached tmux session for the currently displayed instance, or nil if none exists or the session is dead. Intended for callers that drive full-screen attach via tea.ExecProcess.
func (*TerminalPane) CursorState ¶ added in v0.8.0
func (t *TerminalPane) CursorState() (vt.Cursor, bool)
CursorState returns the current terminal session's live cursor state, or ok=false when no live emulator-backed session is displayed.
func (*TerminalPane) DetachAll ¶ added in v0.13.0
func (t *TerminalPane) DetachAll() []*tmux.TmuxSession
DetachAll empties the session cache and returns the cached tmux sessions, for a caller dropping this pane to release their attach clients (PausePreview) off the Update goroutine. Unlike Close, nothing is killed: the shells keep running for the next pane that shows them. Pure bookkeeping — no blocking I/O — so it is safe to call from Update.
func (*TerminalPane) DetachExcept ¶ added in v0.13.0
func (t *TerminalPane) DetachExcept(keep map[string]bool) []*tmux.TmuxSession
DetachExcept is DetachAll for the cache entries whose instance titles are not in keep: a pane that stays in use hands over only the sessions its new owner can't show.
func (*TerminalPane) ExtendSelection ¶ added in v0.3.0
func (t *TerminalPane) ExtendSelection(row, col int)
ExtendSelection moves the active selection's cursor to content (row, col).
func (*TerminalPane) ForwardFocus ¶ added in v0.8.0
func (t *TerminalPane) ForwardFocus(in bool)
ForwardFocus forwards a host focus in/out event to the current terminal session, gated on mode 1004. Best-effort.
func (*TerminalPane) ForwardMouse ¶ added in v0.3.0
func (t *TerminalPane) ForwardMouse(cb, col, row int, press bool) error
ForwardMouse forwards one SGR mouse event to the current terminal session.
func (*TerminalPane) GotoBottom ¶
func (t *TerminalPane) GotoBottom()
GotoBottom returns to the live tail on both paths.
func (*TerminalPane) GotoTop ¶
func (t *TerminalPane) GotoTop() error
GotoTop jumps to the oldest line of history (TUI: a large wheel-up burst).
func (*TerminalPane) InjectSessionForTest ¶ added in v0.6.0
func (t *TerminalPane) InjectSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
InjectSessionForTest installs ts as the cached terminal session for the given instance title, bypassing ensureSessionLocked's normal lazy-spawn path so a test can pin a specific (possibly dead) session in place. Test-only: the name and doc comment are guardrails, nothing about the method enforces test-only use.
func (*TerminalPane) IsScrolling ¶
func (t *TerminalPane) IsScrolling() bool
IsScrolling reports whether the pane is scrolled away from the live tail.
func (*TerminalPane) PageDown ¶
func (t *TerminalPane) PageDown() error
PageDown scrolls down by half a pane height (or forwards a burst of wheel-downs).
func (*TerminalPane) PageUp ¶
func (t *TerminalPane) PageUp() error
PageUp scrolls up by half a pane height (or forwards a burst of wheel-ups).
func (*TerminalPane) Paste ¶ added in v0.3.0
func (t *TerminalPane) Paste(text string) error
Paste sends text to the current terminal session as a bracketed paste.
func (*TerminalPane) ResetToNormalMode ¶
func (t *TerminalPane) ResetToNormalMode()
ResetToNormalMode returns the pane to the live tail on both paths.
func (*TerminalPane) ScrollDown ¶
func (t *TerminalPane) ScrollDown() error
ScrollDown scrolls one line down toward the live tail (or forwards a damped wheel-down to a TUI agent).
func (*TerminalPane) ScrollPercent ¶
func (t *TerminalPane) ScrollPercent() float64
ScrollPercent returns the scroll position as a fraction [0, 1]; 1.0 == live tail (bottom).
func (*TerminalPane) ScrollUp ¶
func (t *TerminalPane) ScrollUp() error
ScrollUp scrolls one line up into history (or forwards a damped wheel-up to a TUI agent on the alternate screen).
func (*TerminalPane) SelectedText ¶ added in v0.3.0
func (t *TerminalPane) SelectedText() string
SelectedText returns the currently selected text (plain), or "" if none.
func (*TerminalPane) SendKeysRaw ¶
func (t *TerminalPane) SendKeysRaw(b []byte) error
SendKeysRaw writes raw bytes to the current terminal tmux PTY.
func (*TerminalPane) SendKeysToInstance ¶ added in v0.1.2
func (t *TerminalPane) SendKeysToInstance(title, text string) error
SendKeysToInstance sends text followed by Enter to the cached terminal session for the named instance, regardless of which instance is currently displayed. Returns an error if no session is cached for that title or the session has died — callers (typically scripts) should surface the error rather than silently no-op'ing so the user knows the keystroke didn't land.
func (*TerminalPane) SendPrompt ¶
func (t *TerminalPane) SendPrompt(text string) error
SendPrompt sends text followed by Enter to the current terminal session.
func (*TerminalPane) SetSize ¶
func (t *TerminalPane) SetSize(width, height int)
SetSize resizes the pane under the internal mutex. The internal tmux session owned by TerminalPane is resized lazily on the next tick so this call remains cheap.
func (*TerminalPane) ShowingFallback ¶ added in v0.8.0
func (t *TerminalPane) ShowingFallback() bool
ShowingFallback reports whether the pane is displaying fallback text instead of live terminal content (no cursor applies there).
func (*TerminalPane) String ¶
func (t *TerminalPane) String() string
func (*TerminalPane) UpdateContent ¶
func (t *TerminalPane) UpdateContent(instance *core.InstanceView) error
UpdateContent captures the terminal pane output. At the live tail it tails the live emulator screen (capture-pane fallback when no emulator); when scrolled it windows the emulator's scrollback in-process (ScrollModel), or, on the no-emulator path, tmux's authoritative history at the current offset.
type Theme ¶ added in v0.13.0
type Theme struct {
Name string
// Surfaces and text.
Ground color.Color // full-bleed background (reserved; no style paints it yet)
Panel color.Color // raised-surface background (workspace-terminal rows, selected cards)
Text color.Color // primary foreground
Dim color.Color // secondary labels, hints
Faint color.Color // barely-there text (aux hints, disabled)
Rule color.Color // unfocused borders, separators
// Accents. Attention is reserved for "an agent needs the user" —
// nothing else may use it, so a calm screen has no loud color.
Accent color.Color // focus, activity, selected borders
Attention color.Color // needs-input / bell — the ONLY loud color
Highlight color.Color // key glyphs, scroll footers
OK color.Color // ready status, added lines
Error color.Color // errors, removed lines, destructive accents
Workspace color.Color // workspace labels, workspace-terminal identity
Info color.Color // informational text, hunk headers, running tabs
// Selection (list rows, pickers).
SelectionBg color.Color
SelectionFg color.Color
}
Theme is a named palette of semantic color roles. Components never reference literal colors — they reference the package-level role vars below, which ApplyTheme reassigns. Styles built from roles at package init would capture stale values, so any package-level lipgloss.Style derived from a role must be (re)built inside a RegisterThemeHook callback (see rebuildListStyles in list.go for the pattern).
type Workbench ¶ added in v0.13.0
type Workbench struct {
Markdown *MarkdownPane
// contains filtered or unexported fields
}
Workbench renders the right panel of workbench mode: a tab strip over one of markdown / diff / files / terminal. It owns its MarkdownPane and DiffPane; the TerminalPane is the session's shared pane (see SplitPane.Terminal for the sizing-order contract).
func NewWorkbench ¶ added in v0.13.0
func NewWorkbench(diff *DiffPane, terminal *TerminalPane) *Workbench
func (*Workbench) FileUnderCursor ¶ added in v0.13.0
FileUnderCursor resolves the cursor to an absolute path.
func (*Workbench) FilesBottom ¶ added in v0.13.0
func (w *Workbench) FilesBottom()
func (*Workbench) FilesTop ¶ added in v0.13.0
func (w *Workbench) FilesTop()
FilesTop/FilesBottom jump the files cursor to the first/last entry.
func (*Workbench) Review ¶ added in v0.13.0
func (w *Workbench) Review() ReviewPane
func (*Workbench) SessionTitle ¶ added in v0.13.0
SessionTitle reports the session the panel is currently targeting ("" before the first SetSession).
func (*Workbench) SetFiles ¶ added in v0.13.0
SetFiles installs the files-tab listing (repo-relative paths).
func (*Workbench) SetReview ¶ added in v0.13.0
func (w *Workbench) SetReview(p ReviewPane)
SetReview installs (or clears, with nil) the review pane and sizes it. Callers must pass either a non-nil ReviewPane or an untyped nil; a nil typed pointer boxed into the interface would make the != nil check below misbehave.
func (*Workbench) SetSession ¶ added in v0.13.0
SetSession retargets the panel to a different session. Clears the per-session content (document, file list) and resumes follow mode. No-op when the title is unchanged.
func (*Workbench) SetTab ¶ added in v0.13.0
func (w *Workbench) SetTab(t WorkbenchTab)
func (*Workbench) String ¶ added in v0.13.0
String renders the panel: tab strip as the first content row inside the border, body clipped to the remaining inner box. lipgloss Width/Height are total (border-inclusive) and Height is a minimum — MaxHeight does the capping (repo gotcha). MaxHeight's own truncation is not trusted here either: the body is explicitly clipped to its line budget before rendering, since Height/MaxHeight interaction with border styles has misbehaved in this repo before.
func (*Workbench) Tab ¶ added in v0.13.0
func (w *Workbench) Tab() WorkbenchTab
type WorkbenchTab ¶ added in v0.13.0
type WorkbenchTab int
WorkbenchTab enumerates the right panel's content tabs.
const ( WbTabMarkdown WorkbenchTab = iota WbTabDiff WbTabFiles WbTabTerminal WbTabReview )
type WorkspaceTabBar ¶
type WorkspaceTabBar struct {
// contains filtered or unexported fields
}
WorkspaceTabBar renders a row of workspace tabs at the top of the TUI.
func NewWorkspaceTabBar ¶
func NewWorkspaceTabBar() *WorkspaceTabBar
NewWorkspaceTabBar creates a new workspace tab bar.
func (*WorkspaceTabBar) Height ¶
func (b *WorkspaceTabBar) Height() int
Height returns the rendered height: 0 when empty, 3 when tabs are present (top border + content + bottom border).
func (*WorkspaceTabBar) SetStatuses ¶
func (b *WorkspaceTabBar) SetStatuses(statuses []TabStatus)
SetStatuses updates the per-tab status indicators.
func (*WorkspaceTabBar) SetWidth ¶
func (b *WorkspaceTabBar) SetWidth(w int)
SetWidth sets the available width for the tab bar.
func (*WorkspaceTabBar) SetWorkspaces ¶
func (b *WorkspaceTabBar) SetWorkspaces(names []string, focused int)
SetWorkspaces updates the displayed workspace names and focused index.
func (*WorkspaceTabBar) String ¶
func (b *WorkspaceTabBar) String() string
String renders the tab bar. Returns "" when there are no workspaces.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package overlay implements the modal dialogs layered above the main TUI — the text-input overlay for new instances and prompts, the confirmation overlay for destructive actions, and the branch, profile, and workspace pickers.
|
Package overlay implements the modal dialogs layered above the main TUI — the text-input overlay for new instances and prompts, the confirmation overlay for destructive actions, and the branch, profile, and workspace pickers. |