Documentation
¶
Overview ¶
Package relay provides a thread-safe in-process registry that maps pane IDs to PTY relay handles. When the TUI activates a relay for a pane, the rawReadLoop in the PaneActor sends raw PTY output to the handle's OutputCh, and the relay writes it directly to stdout — bypassing the NATS/VTerm/snapshot polling loop for native-speed interactive programs (vim, htop, etc.).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handle ¶
type Handle struct {
PtyFile *os.File // direct reference to PTY master fd
OutputCh chan []byte // rawReadLoop sends chunks here when relay is active
// contains filtered or unexported fields
}
Handle holds the shared state between the PaneActor's rawReadLoop goroutine and the TUI's PTYRelay. All fields are safe for concurrent access: - OutputCh is a buffered channel (concurrent send/recv is safe by design). - active is an atomic.Bool. - altExitCh is only closed once (guarded by sync.Once in SignalAltExit).
func (*Handle) Activate ¶
func (h *Handle) Activate()
Activate prepares the handle for a new relay session. It drains any stale data from OutputCh, resets the alt-screen exit channel, and sets active=true.
func (*Handle) AltExitCh ¶
func (h *Handle) AltExitCh() <-chan struct{}
AltExitCh returns a channel that is closed when the alt screen exits during an active relay.
func (*Handle) Deactivate ¶
func (h *Handle) Deactivate()
Deactivate marks the relay as inactive. rawReadLoop will stop sending to OutputCh.
func (*Handle) IsActive ¶
IsActive returns true if the relay is currently active (TUI has taken over).
func (*Handle) SignalAltExit ¶
func (h *Handle) SignalAltExit()
SignalAltExit closes the altExitCh to notify the relay that the interactive program has exited (alt screen deactivated). Safe to call multiple times.