tmux

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package tmux provides a wrapper around tmux commands.

Package tmux provides pane output streaming using pipe-pane with polling fallback.

Index

Constants

View Source
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.

View Source
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
)
View Source
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)

View Source
const FieldSeparator = "_NTM_SEP_"

FieldSeparator is used to separate fields in tmux format strings.

Variables

View Source
var DefaultClient = NewClient("")

DefaultClient is the default local client

Functions

func AddPaneTags

func AddPaneTags(paneID string, newTags []string) error

AddPaneTags adds tags to a pane (default client)

func ApplyTiledLayout

func ApplyTiledLayout(session string) error

ApplyTiledLayout applies tiled layout to all windows (default client)

func AttachOrSwitch

func AttachOrSwitch(session string) error

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

func BuildPaneCommand(projectDir, agentCommand string) (string, error)

BuildPaneCommand constructs a safe cd+command string for execution inside a tmux pane, rejecting commands with unsafe control characters.

func CaptureForCheckpoint

func CaptureForCheckpoint(target string) (string, error)

CaptureForCheckpoint captures for checkpoints (default client).

func CaptureForCheckpointContext

func CaptureForCheckpointContext(ctx context.Context, target string) (string, error)

CaptureForCheckpointContext captures with context support (default client).

func CaptureForFullContext

func CaptureForFullContext(target string) (string, error)

CaptureForFullContext captures full context (default client).

func CaptureForFullContextContext

func CaptureForFullContextContext(ctx context.Context, target string) (string, error)

CaptureForFullContextContext captures with context support (default client).

func CaptureForHealthCheck

func CaptureForHealthCheck(target string) (string, error)

CaptureForHealthCheck captures for health checks (default client).

func CaptureForHealthCheckContext

func CaptureForHealthCheckContext(ctx context.Context, target string) (string, error)

CaptureForHealthCheckContext captures with context support (default client).

func CaptureForStatusDetection

func CaptureForStatusDetection(target string) (string, error)

CaptureForStatusDetection captures for status detection (default client).

func CaptureForStatusDetectionContext

func CaptureForStatusDetectionContext(ctx context.Context, target string) (string, error)

CaptureForStatusDetectionContext captures with context support (default client).

func CapturePaneOutput

func CapturePaneOutput(target string, lines int) (string, error)

CapturePaneOutput captures the output of a pane (default client)

func CapturePaneOutputContext

func CapturePaneOutputContext(ctx context.Context, target string, lines int) (string, error)

CapturePaneOutputContext captures the output of a pane with cancellation support (default client).

func CreateSession

func CreateSession(name, directory string) error

CreateSession creates a new tmux session (default client)

func DisplayMessage

func DisplayMessage(session, msg string, durationMs int) error

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

func FormatPaneName(session string, agentType string, index int, variant string) string

FormatPaneName formats a pane title according to NTM convention

func FormatTags

func FormatTags(tags []string) string

FormatTags formats tags as a bracket-enclosed string for pane titles. Returns empty string if no tags.

func GetAllPanes

func GetAllPanes() (map[string][]Pane, error)

GetAllPanes returns all panes from all sessions (default client)

func GetCurrentSession

func GetCurrentSession() string

GetCurrentSession returns the current session name (default client)

func GetDefaultPaneIndex

func GetDefaultPaneIndex(session string) (int, error)

GetDefaultPaneIndex returns the default pane index (default client)

func GetFirstWindow

func GetFirstWindow(session string) (int, error)

GetFirstWindow returns the first window index for a session (default client)

func GetPaneActivity

func GetPaneActivity(paneID string) (time.Time, error)

GetPaneActivity returns the last activity time for a pane (default client)

func GetPaneLastActivityAge

func GetPaneLastActivityAge(paneID string) (time.Duration, error)

GetPaneLastActivityAge returns how long ago the pane was last active (default client)

func GetPaneTags

func GetPaneTags(paneID string) ([]string, error)

GetPaneTags returns the tags for a pane (default client)

func GetPaneTitle

func GetPaneTitle(paneID string) (string, error)

GetPaneTitle returns the title of a pane (default client)

func HasAnyPaneTag

func HasAnyPaneTag(paneID string, tags []string) (bool, error)

HasAnyPaneTag returns true if the pane has any of the specified tags (default client)

func HasPaneTag

func HasPaneTag(paneID, tag string) (bool, error)

HasPaneTag returns true if the pane has the specified tag (default client)

func InTmux

func InTmux() bool

InTmux returns true if currently inside a tmux session

func IsAttached

func IsAttached(session string) bool

IsAttached checks if a session is currently attached (default client)

func IsInstalled

func IsInstalled() bool

IsInstalled checks if tmux is available

func IsRecentlyActive

func IsRecentlyActive(paneID string, threshold time.Duration) (bool, error)

IsRecentlyActive checks if a pane has had activity within the threshold (default client)

func KillPane

func KillPane(paneID string) error

KillPane kills a tmux pane (default client)

func KillSession

func KillSession(session string) error

KillSession kills a tmux session (default client)

func PasteKeys

func PasteKeys(target, content string, enter bool) error

PasteKeys pastes content to a pane (default client)

func PasteKeysWithDelay

func PasteKeysWithDelay(target, content string, enter bool, enterDelay time.Duration) error

PasteKeysWithDelay pastes content to a pane with a configurable delay (default client)

func RemovePaneTags

func RemovePaneTags(paneID string, tagsToRemove []string) error

RemovePaneTags removes specific tags from a pane (default client)

func RespawnPane

func RespawnPane(target string, kill bool) error

RespawnPane respawns a pane, optionally killing the current process (-k) (default client)

func RespawnPaneContext

func RespawnPaneContext(ctx context.Context, target string, kill bool) error

RespawnPaneContext respawns a pane with cancellation support (default client)

func SanitizePaneCommand

func SanitizePaneCommand(cmd string) (string, error)

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

func SendBuffer(target, content string, enter bool) error

SendBuffer sends content using the buffer mechanism (default client)

func SendBufferWithDelay added in v1.7.0

func SendBufferWithDelay(target, content string, enter bool, enterDelay time.Duration) error

SendBufferWithDelay sends content using the buffer mechanism with delay (default client)

func SendEOF

func SendEOF(target string) error

SendEOF sends Ctrl+D (EOF) to a pane (default client)

func SendInterrupt

func SendInterrupt(target string) error

SendInterrupt sends Ctrl+C to a pane (default client)

func SendKeys

func SendKeys(target, keys string, enter bool) error

SendKeys sends keys to a pane (default client)

func SendKeysForAgent added in v1.7.0

func SendKeysForAgent(target, keys string, enter bool, agentType AgentType) error

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

func SendKeysWithDelay(target, keys string, enter bool, enterDelay time.Duration) error

SendKeysWithDelay sends keys to a pane with a configurable Enter delay (default client)

func SessionExists

func SessionExists(name string) bool

SessionExists checks if a session exists (default client)

func SetPaneTags

func SetPaneTags(paneID string, tags []string) error

SetPaneTags sets the tags for a pane (default client)

func SetPaneTitle

func SetPaneTitle(paneID, title string) error

SetPaneTitle sets the title of a pane (default client)

func ShellQuote

func ShellQuote(s string) string

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

func SplitWindow(session string, directory string) (string, error)

SplitWindow creates a new pane in the session (default client)

func ValidateSessionName

func ValidateSessionName(name string) error

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 (-).

func ZoomPane

func ZoomPane(session string, paneIndex int) error

ZoomPane zooms a specific pane (default client)

Types

type AgentType

type AgentType = agent.AgentType

AgentType represents the type of AI agent

type Client

type Client struct {
	Remote string // "user@host" or empty for local
}

Client handles tmux operations, optionally on a remote host

func NewClient

func NewClient(remote string) *Client

NewClient creates a new tmux client

func (*Client) AddPaneTags

func (c *Client) AddPaneTags(paneID string, newTags []string) error

AddPaneTags adds tags to a pane without removing existing ones. Duplicate tags are not added.

func (*Client) ApplyTiledLayout

func (c *Client) ApplyTiledLayout(session string) error

ApplyTiledLayout applies tiled layout to all windows

func (*Client) AttachOrSwitch

func (c *Client) AttachOrSwitch(session string) error

AttachOrSwitch attaches to a session or switches if already in tmux

func (*Client) CaptureForCheckpoint

func (c *Client) CaptureForCheckpoint(target string) (string, error)

CaptureForCheckpoint captures maximum output for checkpoint/pipeline operations. Uses LinesCheckpoint (2000 lines) for complete session state.

func (*Client) CaptureForCheckpointContext

func (c *Client) CaptureForCheckpointContext(ctx context.Context, target string) (string, error)

CaptureForCheckpointContext captures with context support for checkpoints.

func (*Client) CaptureForFullContext

func (c *Client) CaptureForFullContext(target string) (string, error)

CaptureForFullContext captures comprehensive output for analysis. Uses LinesFullContext (500 lines) for grep, diff, save, and context estimation.

func (*Client) CaptureForFullContextContext

func (c *Client) CaptureForFullContextContext(ctx context.Context, target string) (string, error)

CaptureForFullContextContext captures with context support for full analysis.

func (*Client) CaptureForHealthCheck

func (c *Client) CaptureForHealthCheck(target string) (string, error)

CaptureForHealthCheck captures output for health analysis and error detection. Uses LinesHealthCheck (50 lines) to balance between detail and performance.

func (*Client) CaptureForHealthCheckContext

func (c *Client) CaptureForHealthCheckContext(ctx context.Context, target string) (string, error)

CaptureForHealthCheckContext captures with context support for health checks.

func (*Client) CaptureForStatusDetection

func (c *Client) CaptureForStatusDetection(target string) (string, error)

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

func (c *Client) CapturePaneOutput(target string, lines int) (string, error)

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

func (c *Client) CreateSession(name, directory string) error

CreateSession creates a new tmux session

func (*Client) DisplayMessage

func (c *Client) DisplayMessage(session, msg string, durationMs int) error

DisplayMessage shows a message in the tmux status line

func (*Client) GetAllPanesContext

func (c *Client) GetAllPanesContext(ctx context.Context) (map[string][]Pane, error)

GetAllPanesContext returns all panes from all sessions, grouped by session name.

func (*Client) GetCurrentSession

func (c *Client) GetCurrentSession() string

GetCurrentSession returns the current session name (if in tmux)

func (*Client) GetDefaultPaneIndex

func (c *Client) GetDefaultPaneIndex(session string) (int, error)

GetDefaultPaneIndex returns the default pane index (respects pane-base-index)

func (*Client) GetFirstWindow

func (c *Client) GetFirstWindow(session string) (int, error)

GetFirstWindow returns the first window index for a session

func (*Client) GetPaneActivity

func (c *Client) GetPaneActivity(paneID string) (time.Time, error)

GetPaneActivity returns the last activity time for a pane

func (*Client) GetPaneLastActivityAge

func (c *Client) GetPaneLastActivityAge(paneID string) (time.Duration, error)

GetPaneLastActivityAge returns how long ago the pane was last active

func (*Client) GetPaneTags

func (c *Client) GetPaneTags(paneID string) ([]string, error)

GetPaneTags returns the tags for a pane parsed from its title. Returns nil if no tags are found.

func (*Client) GetPaneTitle

func (c *Client) GetPaneTitle(paneID string) (string, error)

GetPaneTitle returns the title of a pane

func (*Client) GetPanes

func (c *Client) GetPanes(session string) ([]Pane, error)

GetPanes returns all panes in a session

func (*Client) GetPanesContext

func (c *Client) GetPanesContext(ctx context.Context, session string) ([]Pane, error)

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

func (c *Client) GetSession(name string) (*Session, error)

GetSession returns detailed info about a session

func (*Client) HasAnyPaneTag

func (c *Client) HasAnyPaneTag(paneID string, tags []string) (bool, error)

HasAnyPaneTag returns true if the pane has any of the specified tags (OR logic).

func (*Client) HasPaneTag

func (c *Client) HasPaneTag(paneID, tag string) (bool, error)

HasPaneTag returns true if the pane has the specified tag.

func (*Client) IsAttached

func (c *Client) IsAttached(session string) bool

IsAttached checks if a session is currently attached

func (*Client) IsInstalled

func (c *Client) IsInstalled() bool

IsInstalled checks if tmux is available on the target host

func (*Client) IsRecentlyActive

func (c *Client) IsRecentlyActive(paneID string, threshold time.Duration) (bool, error)

IsRecentlyActive checks if a pane has had activity within the threshold

func (*Client) KillPane

func (c *Client) KillPane(paneID string) error

KillPane kills a tmux pane

func (*Client) KillSession

func (c *Client) KillSession(session string) error

KillSession kills a tmux session

func (*Client) ListSessions

func (c *Client) ListSessions() ([]Session, error)

ListSessions returns all tmux sessions

func (*Client) PasteKeys

func (c *Client) PasteKeys(target, content string, enter bool) error

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

func (c *Client) RemovePaneTags(paneID string, tagsToRemove []string) error

RemovePaneTags removes specific tags from a pane.

func (*Client) RespawnPane

func (c *Client) RespawnPane(target string, kill bool) error

RespawnPane respawns a pane, optionally killing the current process (-k)

func (*Client) RespawnPaneContext

func (c *Client) RespawnPaneContext(ctx context.Context, target string, kill bool) error

RespawnPaneContext respawns a pane with cancellation support

func (*Client) Run

func (c *Client) Run(args ...string) (string, error)

Run executes a tmux command

func (*Client) RunContext

func (c *Client) RunContext(ctx context.Context, args ...string) (string, error)

RunContext executes a tmux command with cancellation support.

func (*Client) RunSilent

func (c *Client) RunSilent(args ...string) error

RunSilent executes a tmux command ignoring output

func (*Client) RunSilentContext

func (c *Client) RunSilentContext(ctx context.Context, args ...string) error

RunSilentContext executes a tmux command with cancellation support, ignoring stdout.

func (*Client) SendBuffer added in v1.7.0

func (c *Client) SendBuffer(target, content string, enter bool) error

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

func (c *Client) SendEOF(target string) error

SendEOF sends Ctrl+D (EOF) to a pane

func (*Client) SendInterrupt

func (c *Client) SendInterrupt(target string) error

SendInterrupt sends Ctrl+C to a pane

func (*Client) SendKeys

func (c *Client) SendKeys(target, keys string, enter bool) error

SendKeys sends keys to a pane with the default Enter delay (50ms for agent TUIs)

func (*Client) SendKeysForAgent added in v1.7.0

func (c *Client) SendKeysForAgent(target, keys string, enter bool, agentType AgentType) error

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

func (c *Client) SendKeysWithDelay(target, keys string, enter bool, enterDelay time.Duration) error

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

func (c *Client) SessionExists(name string) bool

SessionExists checks if a session exists

func (*Client) SetPaneTags

func (c *Client) SetPaneTags(paneID string, tags []string) error

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

func (c *Client) SetPaneTitle(paneID, title string) error

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

func (c *Client) SplitWindow(session string, directory string) (string, error)

SplitWindow creates a new pane in the session

func (*Client) ZoomPane

func (c *Client) ZoomPane(session string, paneIndex int) error

ZoomPane zooms a specific pane

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

func GetPanes

func GetPanes(session string) ([]Pane, error)

GetPanes returns all panes in a session (default client)

func GetPanesContext

func GetPanesContext(ctx context.Context, session string) ([]Pane, error)

GetPanesContext returns all panes in a session with cancellation support (default client).

type PaneActivity

type PaneActivity struct {
	Pane         Pane
	LastActivity time.Time
}

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

func (ps *PaneStreamer) Stop()

Stop stops streaming and cleans up.

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

func GetSession(name string) (*Session, error)

GetSession returns detailed info about a session (default client)

func ListSessions

func ListSessions() ([]Session, error)

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

func (sm *StreamManager) StopAll()

StopAll stops all streamers.

func (*StreamManager) StopStream

func (sm *StreamManager) StopStream(target string)

StopStream stops streaming for a pane.

Jump to

Keyboard shortcuts

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