Documentation
¶
Index ¶
- Constants
- func AmuxSessionsByWorkspace(opts Options) (map[string][]string, error)
- func CapturePane(sessionName string, opts Options) ([]byte, error)
- func CapturePaneTail(sessionName string, lines int, opts Options) (string, bool)
- func ClientCommand(sessionName, workDir, command string) string
- func ClientCommandWithOptions(sessionName, workDir, command string, opts Options) string
- func ClientCommandWithTags(sessionName, workDir, command string, opts Options, tags SessionTags) string
- func ClientCommandWithTagsAttach(sessionName, workDir, command string, opts Options, tags SessionTags, ...) string
- func ContentHash(content string) [16]byte
- func EnsureAvailable() error
- func InstallHint() string
- func KillSession(sessionName string, opts Options) error
- func KillSessionsMatchingTags(tags map[string]string, opts Options) (bool, error)
- func KillSessionsWithPrefix(prefix string, opts Options) error
- func KillWorkspaceSessions(wsID string, opts Options) error
- func ListSessions(opts Options) ([]string, error)
- func ListSessionsMatchingTags(tags map[string]string, opts Options) ([]string, error)
- func PanePIDs(sessionName string, opts Options) ([]int, error)
- func SessionCreatedAt(sessionName string, opts Options) (int64, error)
- func SessionHasClients(sessionName string, opts Options) (bool, error)
- func SessionName(parts ...string) string
- func SessionTagValue(sessionName, key string, opts Options) (string, error)
- func SetMonitorActivityOn(opts Options) error
- func SetSessionTagValue(sessionName, key, value string, opts Options) error
- func SetStatusOff(opts Options) error
- type Options
- type SessionActivity
- type SessionState
- type SessionTagValues
- type SessionTags
Constants ¶
const ( TagLastOutputAt = "@amux_last_output_at" TagLastInputAt = "@amux_last_input_at" )
Variables ¶
This section is empty.
Functions ¶
func AmuxSessionsByWorkspace ¶
AmuxSessionsByWorkspace returns all @amux=1 sessions grouped by their @amux_workspace value. Sessions without a workspace tag are omitted.
func CapturePane ¶
CapturePane captures the scrollback history of a tmux pane (excluding the visible screen area) with ANSI escape codes preserved. Returns nil if the session has no scrollback or does not exist.
func CapturePaneTail ¶
CapturePaneTail captures the last N lines of a session's active pane. Returns the content and a success flag. Returns ("", false) on error (e.g., session doesn't exist or capture times out).
func ClientCommand ¶
func ClientCommandWithTags ¶
func ClientCommandWithTags(sessionName, workDir, command string, opts Options, tags SessionTags) string
func ClientCommandWithTagsAttach ¶
func ClientCommandWithTagsAttach(sessionName, workDir, command string, opts Options, tags SessionTags, detachExisting bool) string
func ContentHash ¶
ContentHash returns a fast hash of the content for change detection.
func EnsureAvailable ¶
func EnsureAvailable() error
func InstallHint ¶
func InstallHint() string
func KillSession ¶
func KillSessionsMatchingTags ¶
KillSessionsMatchingTags kills sessions that match all provided tags.
func KillSessionsWithPrefix ¶
KillSessionsWithPrefix kills all sessions with a matching name prefix.
func KillWorkspaceSessions ¶
KillWorkspaceSessions kills all sessions for a workspace ID.
func ListSessions ¶
ListSessions returns all tmux session names for the configured server.
func ListSessionsMatchingTags ¶
ListSessionsMatchingTags returns sessions matching all provided tags.
func PanePIDs ¶
PanePIDs returns the PID of each pane's initial process in the given session. The -s flag lists panes across all windows in the session, not just the active one.
func SessionCreatedAt ¶
SessionCreatedAt returns the tmux session creation timestamp (unix seconds).
func SessionHasClients ¶
SessionHasClients reports whether the tmux session has any attached clients.
func SessionName ¶
func SessionTagValue ¶
SessionTagValue returns a session option value for the given tag key.
func SetMonitorActivityOn ¶
SetMonitorActivityOn enables tmux monitor-activity globally. Called once at startup and when the tmux server name changes, rather than on every activity scan.
func SetSessionTagValue ¶ added in v0.0.12
SetSessionTagValue sets a tmux session option for the given session. Returns nil if the session no longer exists.
func SetStatusOff ¶
SetStatusOff disables the tmux status line globally for the server.
Types ¶
type Options ¶
type Options struct {
ServerName string
ConfigPath string
HideStatus bool
DisableMouse bool
DefaultTerminal string
CommandTimeout time.Duration
}
func DefaultOptions ¶
func DefaultOptions() Options
type SessionActivity ¶
func ActiveAgentSessionsByActivity ¶
func ActiveAgentSessionsByActivity(window time.Duration, opts Options) ([]SessionActivity, error)
ActiveAgentSessionsByActivity returns tagged agent sessions with recent tmux activity. Activity is derived from tmux's window_activity timestamp. Note: monitor-activity is set once at startup and per-session at creation via SetMonitorActivityOn, not on every scan.
type SessionState ¶
func SessionStateFor ¶
func SessionStateFor(sessionName string, opts Options) (SessionState, error)
type SessionTagValues ¶
SessionTagValues stores tag values for a tmux session.
func SessionsWithTags ¶
func SessionsWithTags(match map[string]string, keys []string, opts Options) ([]SessionTagValues, error)
SessionsWithTags returns sessions matching the provided tags, plus values for requested tag keys.