Documentation
¶
Overview ¶
Package extpane manages external terminal tabs for sub-agent and teammate streaming output.
Design: Each agent gets its own terminal tab running `tail -f <logfile>`. The TUI writes streaming output to a temp file via atomic appends. The tab displays the file with native scrolling. The main TUI layout is never affected — tabs are separate full-screen surfaces.
Detection priority: tmux > iTerm2 > Kitty. Never two at once.
Index ¶
- type Backend
- type ExtPane
- type Manager
- func (m *Manager) Available() bool
- func (m *Manager) CloseAll()
- func (m *Manager) EnsurePane(agentID, name, kind string)
- func (m *Manager) HandleDone(agentID, name string, isError bool)
- func (m *Manager) UpdateStatus(agentID, name, kind, status string)
- func (m *Manager) WriteText(agentID, text string)
- func (m *Manager) WriteTextImmediate(agentID, text string)
- func (m *Manager) WriteToolCall(agentID, toolName, detail string)
- func (m *Manager) WriteToolResult(agentID, toolName, result string, isError bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// CreateTab creates a new tab/window running `tail -f <logfile>`.
// Returns a backend-specific tab identifier.
CreateTab(ctx context.Context, title, logfile string) (string, error)
// CloseTab closes the tab.
CloseTab(tabID string) error
// Name returns the backend identifier.
Name() string
}
Backend abstracts a terminal's tab creation/destruction.
type ExtPane ¶
type ExtPane struct {
AgentID string
Name string
Kind string
TabID string
LogFile *os.File
LogPath string
CreatedAt time.Time
Done bool
DoneAt time.Time
// contains filtered or unexported fields
}
ExtPane tracks one agent's external tab + log file.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the external tab lifecycle for all agents.
func NewManager ¶
func NewManager() *Manager
NewManager creates a Manager, auto-detecting the best available backend. Priority: tmux > iTerm2 > Kitty. Returns a Manager with a nil backend if no terminal is suitable (all operations become no-ops).
func (*Manager) CloseAll ¶
func (m *Manager) CloseAll()
CloseAll immediately closes all external tabs. Called on TUI shutdown.
func (*Manager) EnsurePane ¶
EnsurePane creates a tab + log file for the given agent if one doesn't exist yet. Uses a `creating` set to prevent duplicate tab creation during the async backend call.
func (*Manager) HandleDone ¶
HandleDone marks the agent as complete and schedules tab cleanup.
func (*Manager) UpdateStatus ¶
UpdateStatus updates the tab title.
func (*Manager) WriteText ¶
WriteText queues streaming text for an agent's log file. Text is buffered and flushed periodically.
func (*Manager) WriteTextImmediate ¶
WriteTextImmediate writes text to the log file without buffering.
func (*Manager) WriteToolCall ¶
WriteToolCall writes a formatted tool call line.
func (*Manager) WriteToolResult ¶
WriteToolResult writes a formatted tool result line.