Documentation
¶
Overview ¶
Package tmux provides a wrapper around tmux commands.
Package tmux provides pane output streaming using pipe-pane with polling fallback.
Index ¶
- Constants
- Variables
- func AddPaneTags(paneID string, newTags []string) error
- func ApplyTiledLayout(session string) error
- func AttachOrSwitch(session string) error
- func BinaryPath() string
- func BuildPaneCommand(projectDir, agentCommand string) (string, error)
- func CaptureForCheckpoint(target string) (string, error)
- func CaptureForCheckpointContext(ctx context.Context, target string) (string, error)
- func CaptureForFullContext(target string) (string, error)
- func CaptureForFullContextContext(ctx context.Context, target string) (string, error)
- func CaptureForHealthCheck(target string) (string, error)
- func CaptureForHealthCheckContext(ctx context.Context, target string) (string, error)
- func CaptureForStatusDetection(target string) (string, error)
- func CaptureForStatusDetectionContext(ctx context.Context, target string) (string, error)
- func CapturePaneOutput(target string, lines int) (string, error)
- func CapturePaneOutputContext(ctx context.Context, target string, lines int) (string, error)
- func CreateSession(name, directory string) error
- func DisplayMessage(session, msg string, durationMs int) error
- func EnsureInstalled() error
- func FormatPaneName(session string, agentType string, index int, variant string) string
- func FormatTags(tags []string) string
- func GetAllPanes() (map[string][]Pane, error)
- func GetCurrentSession() string
- func GetDefaultPaneIndex(session string) (int, error)
- func GetFirstWindow(session string) (int, error)
- func GetPaneActivity(paneID string) (time.Time, error)
- func GetPaneLastActivityAge(paneID string) (time.Duration, error)
- func GetPaneTags(paneID string) ([]string, error)
- func GetPaneTitle(paneID string) (string, error)
- func HasAnyPaneTag(paneID string, tags []string) (bool, error)
- func HasPaneTag(paneID, tag string) (bool, error)
- func InTmux() bool
- func IsAttached(session string) bool
- func IsInstalled() bool
- func IsRecentlyActive(paneID string, threshold time.Duration) (bool, error)
- func KillPane(paneID string) error
- func KillSession(session string) error
- func PasteKeys(target, content string, enter bool) error
- func PasteKeysWithDelay(target, content string, enter bool, enterDelay time.Duration) error
- func RemovePaneTags(paneID string, tagsToRemove []string) error
- func RespawnPane(target string, kill bool) error
- func RespawnPaneContext(ctx context.Context, target string, kill bool) error
- func SanitizePaneCommand(cmd string) (string, error)
- func SendBuffer(target, content string, enter bool) error
- func SendBufferWithDelay(target, content string, enter bool, enterDelay time.Duration) error
- func SendEOF(target string) error
- func SendInterrupt(target string) error
- func SendKeys(target, keys string, enter bool) error
- func SendKeysForAgent(target, keys string, enter bool, agentType AgentType) error
- func SendKeysForAgentWithDelay(target, keys string, enter bool, enterDelay time.Duration, agentType AgentType) error
- func SendKeysWithDelay(target, keys string, enter bool, enterDelay time.Duration) error
- func SessionExists(name string) bool
- func SetPaneTags(paneID string, tags []string) error
- func SetPaneTitle(paneID, title string) error
- func ShellQuote(s string) string
- func SplitWindow(session string, directory string) (string, error)
- func ValidateSessionName(name string) error
- func ZoomPane(session string, paneIndex int) error
- type AgentType
- type Client
- func (c *Client) AddPaneTags(paneID string, newTags []string) error
- func (c *Client) ApplyTiledLayout(session string) error
- func (c *Client) AttachOrSwitch(session string) error
- func (c *Client) CaptureForCheckpoint(target string) (string, error)
- func (c *Client) CaptureForCheckpointContext(ctx context.Context, target string) (string, error)
- func (c *Client) CaptureForFullContext(target string) (string, error)
- func (c *Client) CaptureForFullContextContext(ctx context.Context, target string) (string, error)
- func (c *Client) CaptureForHealthCheck(target string) (string, error)
- func (c *Client) CaptureForHealthCheckContext(ctx context.Context, target string) (string, error)
- func (c *Client) CaptureForStatusDetection(target string) (string, error)
- func (c *Client) CaptureForStatusDetectionContext(ctx context.Context, target string) (string, error)
- func (c *Client) CapturePaneOutput(target string, lines int) (string, error)
- func (c *Client) CapturePaneOutputContext(ctx context.Context, target string, lines int) (string, error)
- func (c *Client) CreateSession(name, directory string) error
- func (c *Client) DisplayMessage(session, msg string, durationMs int) error
- func (c *Client) GetAllPanesContext(ctx context.Context) (map[string][]Pane, error)
- func (c *Client) GetCurrentSession() string
- func (c *Client) GetDefaultPaneIndex(session string) (int, error)
- func (c *Client) GetFirstWindow(session string) (int, error)
- func (c *Client) GetPaneActivity(paneID string) (time.Time, error)
- func (c *Client) GetPaneLastActivityAge(paneID string) (time.Duration, error)
- func (c *Client) GetPaneTags(paneID string) ([]string, error)
- func (c *Client) GetPaneTitle(paneID string) (string, error)
- func (c *Client) GetPanes(session string) ([]Pane, error)
- func (c *Client) GetPanesContext(ctx context.Context, session string) ([]Pane, error)
- func (c *Client) GetPanesWithActivity(session string) ([]PaneActivity, error)
- func (c *Client) GetPanesWithActivityContext(ctx context.Context, session string) ([]PaneActivity, error)
- func (c *Client) GetSession(name string) (*Session, error)
- func (c *Client) HasAnyPaneTag(paneID string, tags []string) (bool, error)
- func (c *Client) HasPaneTag(paneID, tag string) (bool, error)
- func (c *Client) IsAttached(session string) bool
- func (c *Client) IsInstalled() bool
- func (c *Client) IsRecentlyActive(paneID string, threshold time.Duration) (bool, error)
- func (c *Client) KillPane(paneID string) error
- func (c *Client) KillSession(session string) error
- func (c *Client) ListSessions() ([]Session, error)
- func (c *Client) PasteKeys(target, content string, enter bool) error
- func (c *Client) PasteKeysWithDelay(target, content string, enter bool, enterDelay time.Duration) error
- func (c *Client) RemovePaneTags(paneID string, tagsToRemove []string) error
- func (c *Client) RespawnPane(target string, kill bool) error
- func (c *Client) RespawnPaneContext(ctx context.Context, target string, kill bool) error
- func (c *Client) Run(args ...string) (string, error)
- func (c *Client) RunContext(ctx context.Context, args ...string) (string, error)
- func (c *Client) RunSilent(args ...string) error
- func (c *Client) RunSilentContext(ctx context.Context, args ...string) error
- func (c *Client) SendBuffer(target, content string, enter bool) error
- func (c *Client) SendBufferWithDelay(target, content string, enter bool, enterDelay time.Duration) error
- func (c *Client) SendEOF(target string) error
- func (c *Client) SendInterrupt(target string) error
- func (c *Client) SendKeys(target, keys string, enter bool) error
- func (c *Client) SendKeysForAgent(target, keys string, enter bool, agentType AgentType) error
- func (c *Client) SendKeysForAgentWithDelay(target, keys string, enter bool, enterDelay time.Duration, agentType AgentType) error
- func (c *Client) SendKeysWithDelay(target, keys string, enter bool, enterDelay time.Duration) error
- func (c *Client) SessionExists(name string) bool
- func (c *Client) SetPaneTags(paneID string, tags []string) error
- func (c *Client) SetPaneTitle(paneID, title string) error
- func (c *Client) SplitWindow(session string, directory string) (string, error)
- func (c *Client) ZoomPane(session string, paneIndex int) error
- type Pane
- type PaneActivity
- type PaneStreamer
- type PaneStreamerConfig
- type Session
- type StreamCallback
- type StreamEvent
- type StreamManager
Constants ¶
const ( // LinesStatusDetection is the default for quick status/state detection. // Use for: agent ready checks, ack polling, interrupt detection. LinesStatusDetection = 20 // LinesHealthCheck is the default for health and error analysis. // Use for: error detection, alert generation, process health. LinesHealthCheck = 50 // LinesFullContext is the default for comprehensive context capture. // Use for: context estimation, grep, diff, save operations. LinesFullContext = 500 // LinesCheckpoint is for session checkpoint/restore operations. // Use for: checkpoint capture, pipeline stages. LinesCheckpoint = 2000 )
Capture line budget constants for consistent usage across codebase.
const ( AgentClaude = agent.AgentTypeClaudeCode AgentCodex = agent.AgentTypeCodex AgentGemini = agent.AgentTypeGemini AgentCursor = agent.AgentTypeCursor AgentWindsurf = agent.AgentTypeWindsurf AgentAider = agent.AgentTypeAider AgentUser = agent.AgentTypeUser AgentUnknown = agent.AgentTypeUnknown )
const ( // DefaultEnterDelay is for AI agent TUIs (Claude, Codex, Gemini) which have // their own input buffering and process pasted text quickly. DefaultEnterDelay = 50 * time.Millisecond // ShellEnterDelay is for shell panes (bash, zsh, etc.) which may need more // time to process pasted text before receiving Enter. Shell input handling // can vary based on readline, prompt configuration, and system load. ShellEnterDelay = 150 * time.Millisecond )
Default delays before sending Enter key (milliseconds)
const FieldSeparator = "_NTM_SEP_"
FieldSeparator is used to separate fields in tmux format strings.
Variables ¶
var DefaultClient = NewClient("")
DefaultClient is the default local client
Functions ¶
func AddPaneTags ¶
AddPaneTags adds tags to a pane (default client)
func ApplyTiledLayout ¶
ApplyTiledLayout applies tiled layout to all windows (default client)
func AttachOrSwitch ¶
AttachOrSwitch attaches to a session or switches if already in tmux (default client)
func BinaryPath ¶
func BinaryPath() string
BinaryPath returns the resolved tmux binary path for local execution. It prefers standard install locations and falls back to PATH lookup.
func BuildPaneCommand ¶
BuildPaneCommand constructs a safe cd+command string for execution inside a tmux pane, rejecting commands with unsafe control characters.
func CaptureForCheckpoint ¶
CaptureForCheckpoint captures for checkpoints (default client).
func CaptureForCheckpointContext ¶
CaptureForCheckpointContext captures with context support (default client).
func CaptureForFullContext ¶
CaptureForFullContext captures full context (default client).
func CaptureForFullContextContext ¶
CaptureForFullContextContext captures with context support (default client).
func CaptureForHealthCheck ¶
CaptureForHealthCheck captures for health checks (default client).
func CaptureForHealthCheckContext ¶
CaptureForHealthCheckContext captures with context support (default client).
func CaptureForStatusDetection ¶
CaptureForStatusDetection captures for status detection (default client).
func CaptureForStatusDetectionContext ¶
CaptureForStatusDetectionContext captures with context support (default client).
func CapturePaneOutput ¶
CapturePaneOutput captures the output of a pane (default client)
func CapturePaneOutputContext ¶
CapturePaneOutputContext captures the output of a pane with cancellation support (default client).
func CreateSession ¶
CreateSession creates a new tmux session (default client)
func DisplayMessage ¶
DisplayMessage shows a message in the tmux status line (default client)
func EnsureInstalled ¶
func EnsureInstalled() error
EnsureInstalled returns an error if tmux is not installed
func FormatPaneName ¶
FormatPaneName formats a pane title according to NTM convention
func FormatTags ¶
FormatTags formats tags as a bracket-enclosed string for pane titles. Returns empty string if no tags.
func GetAllPanes ¶
GetAllPanes returns all panes from all sessions (default client)
func GetCurrentSession ¶
func GetCurrentSession() string
GetCurrentSession returns the current session name (default client)
func GetDefaultPaneIndex ¶
GetDefaultPaneIndex returns the default pane index (default client)
func GetFirstWindow ¶
GetFirstWindow returns the first window index for a session (default client)
func GetPaneActivity ¶
GetPaneActivity returns the last activity time for a pane (default client)
func GetPaneLastActivityAge ¶
GetPaneLastActivityAge returns how long ago the pane was last active (default client)
func GetPaneTags ¶
GetPaneTags returns the tags for a pane (default client)
func GetPaneTitle ¶
GetPaneTitle returns the title of a pane (default client)
func HasAnyPaneTag ¶
HasAnyPaneTag returns true if the pane has any of the specified tags (default client)
func HasPaneTag ¶
HasPaneTag returns true if the pane has the specified tag (default client)
func IsAttached ¶
IsAttached checks if a session is currently attached (default client)
func IsRecentlyActive ¶
IsRecentlyActive checks if a pane has had activity within the threshold (default client)
func KillSession ¶
KillSession kills a tmux session (default client)
func PasteKeysWithDelay ¶
PasteKeysWithDelay pastes content to a pane with a configurable delay (default client)
func RemovePaneTags ¶
RemovePaneTags removes specific tags from a pane (default client)
func RespawnPane ¶
RespawnPane respawns a pane, optionally killing the current process (-k) (default client)
func RespawnPaneContext ¶
RespawnPaneContext respawns a pane with cancellation support (default client)
func SanitizePaneCommand ¶
SanitizePaneCommand rejects control characters that could inject unintended key sequences (e.g., newlines, carriage returns, escapes) when sending commands into tmux panes.
func SendBuffer ¶ added in v1.7.0
SendBuffer sends content using the buffer mechanism (default client)
func SendBufferWithDelay ¶ added in v1.7.0
SendBufferWithDelay sends content using the buffer mechanism with delay (default client)
func SendInterrupt ¶
SendInterrupt sends Ctrl+C to a pane (default client)
func SendKeysForAgent ¶ added in v1.7.0
SendKeysForAgent sends keys using the appropriate method for the agent type (default client)
func SendKeysForAgentWithDelay ¶ added in v1.7.0
func SendKeysForAgentWithDelay(target, keys string, enter bool, enterDelay time.Duration, agentType AgentType) error
SendKeysForAgentWithDelay sends keys using the appropriate method with delay (default client)
func SendKeysWithDelay ¶
SendKeysWithDelay sends keys to a pane with a configurable Enter delay (default client)
func SessionExists ¶
SessionExists checks if a session exists (default client)
func SetPaneTags ¶
SetPaneTags sets the tags for a pane (default client)
func SetPaneTitle ¶
SetPaneTitle sets the title of a pane (default client)
func ShellQuote ¶
ShellQuote returns a POSIX-shell-safe single-quoted string.
This is required for ssh remote commands because OpenSSH transmits a single command string to the remote shell (not an argv vector).
func SplitWindow ¶
SplitWindow creates a new pane in the session (default client)
func ValidateSessionName ¶
ValidateSessionName checks if a session name is valid. It enforces a strict character set to prevent shell injection risks when used in templates. Allowed: Alphanumeric, underscore (_), dash (-).
Types ¶
type Client ¶
type Client struct {
Remote string // "user@host" or empty for local
}
Client handles tmux operations, optionally on a remote host
func (*Client) AddPaneTags ¶
AddPaneTags adds tags to a pane without removing existing ones. Duplicate tags are not added.
func (*Client) ApplyTiledLayout ¶
ApplyTiledLayout applies tiled layout to all windows
func (*Client) AttachOrSwitch ¶
AttachOrSwitch attaches to a session or switches if already in tmux
func (*Client) CaptureForCheckpoint ¶
CaptureForCheckpoint captures maximum output for checkpoint/pipeline operations. Uses LinesCheckpoint (2000 lines) for complete session state.
func (*Client) CaptureForCheckpointContext ¶
CaptureForCheckpointContext captures with context support for checkpoints.
func (*Client) CaptureForFullContext ¶
CaptureForFullContext captures comprehensive output for analysis. Uses LinesFullContext (500 lines) for grep, diff, save, and context estimation.
func (*Client) CaptureForFullContextContext ¶
CaptureForFullContextContext captures with context support for full analysis.
func (*Client) CaptureForHealthCheck ¶
CaptureForHealthCheck captures output for health analysis and error detection. Uses LinesHealthCheck (50 lines) to balance between detail and performance.
func (*Client) CaptureForHealthCheckContext ¶
CaptureForHealthCheckContext captures with context support for health checks.
func (*Client) CaptureForStatusDetection ¶
CaptureForStatusDetection captures a minimal amount of output for quick state detection. This is optimized for frequent polling operations (ack, ready checks, interrupt). Uses LinesStatusDetection (20 lines) by default.
func (*Client) CaptureForStatusDetectionContext ¶
func (c *Client) CaptureForStatusDetectionContext(ctx context.Context, target string) (string, error)
CaptureForStatusDetectionContext captures with context support for status detection.
func (*Client) CapturePaneOutput ¶
CapturePaneOutput captures the output of a pane
func (*Client) CapturePaneOutputContext ¶
func (c *Client) CapturePaneOutputContext(ctx context.Context, target string, lines int) (string, error)
CapturePaneOutputContext captures the output of a pane with cancellation support.
func (*Client) CreateSession ¶
CreateSession creates a new tmux session
func (*Client) DisplayMessage ¶
DisplayMessage shows a message in the tmux status line
func (*Client) GetAllPanesContext ¶
GetAllPanesContext returns all panes from all sessions, grouped by session name.
func (*Client) GetCurrentSession ¶
GetCurrentSession returns the current session name (if in tmux)
func (*Client) GetDefaultPaneIndex ¶
GetDefaultPaneIndex returns the default pane index (respects pane-base-index)
func (*Client) GetFirstWindow ¶
GetFirstWindow returns the first window index for a session
func (*Client) GetPaneActivity ¶
GetPaneActivity returns the last activity time for a pane
func (*Client) GetPaneLastActivityAge ¶
GetPaneLastActivityAge returns how long ago the pane was last active
func (*Client) GetPaneTags ¶
GetPaneTags returns the tags for a pane parsed from its title. Returns nil if no tags are found.
func (*Client) GetPaneTitle ¶
GetPaneTitle returns the title of a pane
func (*Client) GetPanesContext ¶
GetPanesContext returns all panes in a session with cancellation support.
func (*Client) GetPanesWithActivity ¶
func (c *Client) GetPanesWithActivity(session string) ([]PaneActivity, error)
GetPanesWithActivity returns all panes in a session with their activity times
func (*Client) GetPanesWithActivityContext ¶
func (c *Client) GetPanesWithActivityContext(ctx context.Context, session string) ([]PaneActivity, error)
GetPanesWithActivityContext returns all panes in a session with their activity times with cancellation support.
func (*Client) GetSession ¶
GetSession returns detailed info about a session
func (*Client) HasAnyPaneTag ¶
HasAnyPaneTag returns true if the pane has any of the specified tags (OR logic).
func (*Client) HasPaneTag ¶
HasPaneTag returns true if the pane has the specified tag.
func (*Client) IsAttached ¶
IsAttached checks if a session is currently attached
func (*Client) IsInstalled ¶
IsInstalled checks if tmux is available on the target host
func (*Client) IsRecentlyActive ¶
IsRecentlyActive checks if a pane has had activity within the threshold
func (*Client) KillSession ¶
KillSession kills a tmux session
func (*Client) ListSessions ¶
ListSessions returns all tmux sessions
func (*Client) PasteKeys ¶
PasteKeys pastes content to a pane using tmux's paste mechanism. This is an alias for SendKeys for now, but may be optimized for large content later.
func (*Client) PasteKeysWithDelay ¶
func (c *Client) PasteKeysWithDelay(target, content string, enter bool, enterDelay time.Duration) error
PasteKeysWithDelay pastes content to a pane with a configurable delay before Enter.
func (*Client) RemovePaneTags ¶
RemovePaneTags removes specific tags from a pane.
func (*Client) RespawnPane ¶
RespawnPane respawns a pane, optionally killing the current process (-k)
func (*Client) RespawnPaneContext ¶
RespawnPaneContext respawns a pane with cancellation support
func (*Client) RunContext ¶
RunContext executes a tmux command with cancellation support.
func (*Client) RunSilentContext ¶
RunSilentContext executes a tmux command with cancellation support, ignoring stdout.
func (*Client) SendBuffer ¶ added in v1.7.0
SendBuffer sends content to a pane using tmux's load-buffer + paste-buffer mechanism. This is the correct way to send multi-line content to agents like Gemini that interpret newlines in send-keys as actual Enter key presses (causing "quote mode" or similar issues).
Unlike SendKeys which uses send-keys -l (literal mode), this method: 1. Loads the content into a tmux buffer 2. Pastes the buffer into the target pane 3. Optionally sends Enter after the paste
This preserves newlines as data rather than as key presses, which is essential for multi-line prompts in Gemini's TUI.
func (*Client) SendBufferWithDelay ¶ added in v1.7.0
func (c *Client) SendBufferWithDelay(target, content string, enter bool, enterDelay time.Duration) error
SendBufferWithDelay sends content using the buffer mechanism with a configurable Enter delay.
func (*Client) SendInterrupt ¶
SendInterrupt sends Ctrl+C to a pane
func (*Client) SendKeys ¶
SendKeys sends keys to a pane with the default Enter delay (50ms for agent TUIs)
func (*Client) SendKeysForAgent ¶ added in v1.7.0
SendKeysForAgent sends keys to a pane using the appropriate method for the agent type. For Gemini agents with multi-line content, it uses the buffer mechanism to avoid newlines being interpreted as Enter key presses. For other agents, it uses the standard send-keys method.
func (*Client) SendKeysForAgentWithDelay ¶ added in v1.7.0
func (c *Client) SendKeysForAgentWithDelay(target, keys string, enter bool, enterDelay time.Duration, agentType AgentType) error
SendKeysForAgentWithDelay sends keys using the appropriate method with a configurable delay.
func (*Client) SendKeysWithDelay ¶
SendKeysWithDelay sends keys to a pane with a configurable delay before Enter. Use ShellEnterDelay for shell panes (bash, zsh) or DefaultEnterDelay for agent TUIs.
func (*Client) SessionExists ¶
SessionExists checks if a session exists
func (*Client) SetPaneTags ¶
SetPaneTags sets the tags for a pane by updating its title. Tags are appended to the title in the format [tag1,tag2,...]. This replaces any existing tags on the pane.
func (*Client) SetPaneTitle ¶
SetPaneTitle sets the title of a pane and disables title changes by programs to prevent shells/processes from overwriting NTM's pane naming convention.
func (*Client) SplitWindow ¶
SplitWindow creates a new pane in the session
type Pane ¶
type Pane struct {
ID string
Index int
WindowIndex int // The window index (0-based)
NTMIndex int // The NTM-specific index parsed from the title (e.g., 1 for cc_1)
Title string
Type AgentType
Variant string // Model alias or persona name (from pane title)
Tags []string // User-defined tags (from pane title, e.g., [frontend,api])
Command string
Width int
Height int
Active bool
PID int // Shell PID
}
Pane represents a tmux pane
type PaneActivity ¶
PaneActivity contains pane info with activity timestamp
func GetPanesWithActivity ¶
func GetPanesWithActivity(session string) ([]PaneActivity, error)
GetPanesWithActivity returns all panes in a session with their activity times (default client)
func GetPanesWithActivityContext ¶
func GetPanesWithActivityContext(ctx context.Context, session string) ([]PaneActivity, error)
GetPanesWithActivityContext returns all panes in a session with their activity times with cancellation support (default client).
type PaneStreamer ¶
type PaneStreamer struct {
// contains filtered or unexported fields
}
PaneStreamer streams output from a single pane.
func NewPaneStreamer ¶
func NewPaneStreamer(client *Client, target string, callback StreamCallback, cfg PaneStreamerConfig) *PaneStreamer
NewPaneStreamer creates a streamer for the given pane target.
func (*PaneStreamer) Start ¶
func (ps *PaneStreamer) Start(ctx context.Context) error
Start begins streaming pane output.
func (*PaneStreamer) Target ¶
func (ps *PaneStreamer) Target() string
Target returns the pane target.
func (*PaneStreamer) UsingFallback ¶
func (ps *PaneStreamer) UsingFallback() bool
UsingFallback returns true if polling mode is active.
type PaneStreamerConfig ¶
type PaneStreamerConfig struct {
// FIFODir is where named pipes are created (default: /tmp/ntm_pane_streams)
FIFODir string
// MaxLinesPerEvent limits lines per WebSocket event (default: 100)
MaxLinesPerEvent int
// FlushInterval is the max time to buffer before flushing (default: 50ms)
FlushInterval time.Duration
// FallbackPollInterval is the polling interval when pipe-pane fails (default: 500ms)
FallbackPollInterval time.Duration
// FallbackPollLines is the number of lines to capture in polling mode (default: 50)
FallbackPollLines int
}
PaneStreamerConfig configures the pane streamer.
func DefaultPaneStreamerConfig ¶
func DefaultPaneStreamerConfig() PaneStreamerConfig
DefaultPaneStreamerConfig returns sensible defaults.
type Session ¶
type Session struct {
Name string
Directory string
Windows int
Panes []Pane
Attached bool
Created string
}
Session represents a tmux session
func GetSession ¶
GetSession returns detailed info about a session (default client)
func ListSessions ¶
ListSessions returns all tmux sessions (default client)
type StreamCallback ¶
type StreamCallback func(event StreamEvent)
StreamCallback is called when new output is available.
type StreamEvent ¶
type StreamEvent struct {
Target string // Pane target (e.g., "session:0")
Lines []string // Output lines
Seq int64 // Sequence number
Timestamp time.Time // When the event was captured
IsFull bool // True if this is a full capture (polling), false if incremental (pipe)
}
StreamEvent represents a pane output event.
type StreamManager ¶
type StreamManager struct {
// contains filtered or unexported fields
}
StreamManager manages multiple pane streamers.
func NewStreamManager ¶
func NewStreamManager(client *Client, callback StreamCallback, cfg PaneStreamerConfig) *StreamManager
NewStreamManager creates a new stream manager.
func (*StreamManager) ListActive ¶
func (sm *StreamManager) ListActive() []string
ListActive returns targets of all active streamers.
func (*StreamManager) StartStream ¶
func (sm *StreamManager) StartStream(target string) error
StartStream starts streaming for a pane. Idempotent.
func (*StreamManager) Stats ¶
func (sm *StreamManager) Stats() map[string]interface{}
Stats returns streaming statistics.
func (*StreamManager) StopStream ¶
func (sm *StreamManager) StopStream(target string)
StopStream stops streaming for a pane.