extpane

package
v1.3.107 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 11 Imported by: 0

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

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) Available

func (m *Manager) Available() bool

Available reports whether external tab output is active.

func (*Manager) CloseAll

func (m *Manager) CloseAll()

CloseAll immediately closes all external tabs. Called on TUI shutdown.

func (*Manager) EnsurePane

func (m *Manager) EnsurePane(agentID, name, kind string)

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

func (m *Manager) HandleDone(agentID, name string, isError bool)

HandleDone marks the agent as complete and schedules tab cleanup.

func (*Manager) UpdateStatus

func (m *Manager) UpdateStatus(agentID, name, kind, status string)

UpdateStatus updates the tab title.

func (*Manager) WriteText

func (m *Manager) WriteText(agentID, text string)

WriteText queues streaming text for an agent's log file. Text is buffered and flushed periodically.

func (*Manager) WriteTextImmediate

func (m *Manager) WriteTextImmediate(agentID, text string)

WriteTextImmediate writes text to the log file without buffering.

func (*Manager) WriteToolCall

func (m *Manager) WriteToolCall(agentID, toolName, detail string)

WriteToolCall writes a formatted tool call line.

func (*Manager) WriteToolResult

func (m *Manager) WriteToolResult(agentID, toolName, result string, isError bool)

WriteToolResult writes a formatted tool result line.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL