Documentation
¶
Overview ¶
Package terminal provides interfaces for terminal multiplexer integrations.
Index ¶
- func DetectTool(content string) string
- func StripANSI(content string) string
- type AllPanesDiscoverer
- type Integration
- type Manager
- func (m *Manager) DiscoverSession(ctx context.Context, slug string, metadata map[string]string) (*SessionInfo, Integration, error)
- func (m *Manager) EnabledIntegrations() []Integration
- func (m *Manager) Get(name string) Integration
- func (m *Manager) HasEnabledIntegrations() bool
- func (m *Manager) IsEnabled(name string) bool
- func (m *Manager) RefreshAll()
- func (m *Manager) Register(i Integration)
- type RateLimiter
- type SessionInfo
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectTool ¶
DetectTool attempts to identify the AI tool from terminal content.
Types ¶
type AllPanesDiscoverer ¶ added in v0.51.0
type AllPanesDiscoverer interface {
DiscoverAllPanes(ctx context.Context, slug string, metadata map[string]string) ([]*SessionInfo, error)
}
AllPanesDiscoverer is implemented by integrations that can return all agent panes.
type Integration ¶
type Integration interface {
// Name returns the integration name (e.g., "tmux").
Name() string
// Available returns true if this integration is usable (e.g., tmux is installed).
Available() bool
// RefreshCache updates cached session data. Call once per poll cycle
// to batch tmux queries efficiently.
RefreshCache()
// DiscoverSession finds a terminal session for the given slug and metadata.
// Returns nil if no matching session is found.
DiscoverSession(ctx context.Context, slug string, metadata map[string]string) (*SessionInfo, error)
// GetStatus returns the current status of a previously discovered session.
GetStatus(ctx context.Context, info *SessionInfo) (Status, error)
}
Integration defines the interface for terminal multiplexer integrations.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages terminal integrations.
func NewManager ¶
NewManager creates a new integration manager with the given enabled integrations.
func (*Manager) DiscoverSession ¶
func (m *Manager) DiscoverSession(ctx context.Context, slug string, metadata map[string]string) (*SessionInfo, Integration, error)
DiscoverSession tries all enabled integrations to find a session.
func (*Manager) EnabledIntegrations ¶
func (m *Manager) EnabledIntegrations() []Integration
EnabledIntegrations returns all enabled and available integrations.
func (*Manager) Get ¶
func (m *Manager) Get(name string) Integration
Get returns an integration by name, or nil if not found.
func (*Manager) HasEnabledIntegrations ¶
HasEnabledIntegrations returns true if any integrations are enabled and available.
func (*Manager) RefreshAll ¶
func (m *Manager) RefreshAll()
RefreshAll calls RefreshCache on all enabled integrations.
func (*Manager) Register ¶
func (m *Manager) Register(i Integration)
Register adds an integration to the manager.
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter provides simple thread-safe rate limiting for events. It ensures that events are processed at most once per minimum interval.
func NewRateLimiter ¶
func NewRateLimiter(eventsPerSecond int) *RateLimiter
NewRateLimiter creates a new rate limiter with the specified events per second.
func NewRateLimiterWithInterval ¶ added in v0.51.0
func NewRateLimiterWithInterval(interval time.Duration) *RateLimiter
NewRateLimiterWithInterval creates a rate limiter with a fixed minimum interval between events.
func (*RateLimiter) Allow ¶
func (rl *RateLimiter) Allow() bool
Allow returns true if the event should be allowed based on the rate limit.
type SessionInfo ¶
type SessionInfo struct {
Name string // terminal session name (e.g., tmux session name)
WindowIndex string // tmux window index (e.g., "0", "1")
PaneID string // tmux pane ID in %N format
WindowName string // window name (for display and template data)
Status Status // current detected status
DetectedTool string // detected AI tool (claude, gemini, etc.)
PaneContent string // captured pane content for preview
}
SessionInfo holds information about a discovered terminal session.
type Status ¶
type Status string
Status represents the detected state of a terminal session.
const ( StatusActive Status = "active" // agent is actively working (spinner/busy indicator) StatusApproval Status = "approval" // agent needs permission (Yes/No dialog) StatusQuestion Status = "question" // agent asked the user a question (AskUserQuestion etc.) StatusReady Status = "ready" // agent finished, waiting for next input (❯ prompt) StatusMissing Status = "missing" // terminal session not found )
Directories
¶
| Path | Synopsis |
|---|---|
|
Package assess implements Stage 1 of the two-stage status assessment engine: a pure, stateless mapping from one terminal snapshot to one semantic assessment.
|
Package assess implements Stage 1 of the two-stage status assessment engine: a pure, stateless mapping from one terminal snapshot to one semantic assessment. |
|
Package content scores terminal content for agent-like structure.
|
Package content scores terminal content for agent-like structure. |
|
Package process reads OS-level process information for tmux panes.
|
Package process reads OS-level process information for tmux panes. |
|
Package status implements Stage 2 of the two-stage status assessment engine: a stateful debounce tracker that turns per-poll assess.Assessment values into stable, published terminal.Status values.
|
Package status implements Stage 2 of the two-stage status assessment engine: a stateful debounce tracker that turns per-poll assess.Assessment values into stable, published terminal.Status values. |
|
Package tmux implements terminal integration for tmux.
|
Package tmux implements terminal integration for tmux. |