Documentation
¶
Index ¶
- Constants
- Variables
- type Lease
- type Manager
- func (m *Manager) Acquire(ctx context.Context, clientID, paneID string, columns, rows int) (int, int, error)
- func (m *Manager) ActiveColumns(paneID string) (int, bool)
- func (m *Manager) ActiveRows(paneID string) (int, bool)
- func (m *Manager) Release(ctx context.Context, clientID, paneID string) error
- func (m *Manager) ReleaseClient(ctx context.Context, clientID string) error
- func (m *Manager) ResizedWithin(paneID string, window time.Duration) bool
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) Shutdown(ctx context.Context) error
- func (m *Manager) SweepExpired(ctx context.Context) error
- type ProcessInfoProvider
Constants ¶
const ( MinColumns = 40 MaxColumns = 240 MinRows = 10 MaxRows = 120 // LeaseTTL must ride out hidden-tab timer clamping: desktop Safari // reports an occluded window as hidden and degrades its timers to a // measured ~60-65s cadence within two minutes, so a 30s TTL lapsed the // lease — and resized the shared pane — during every longer glance away, // even though renewals were still arriving. Twice the measured clamp // keeps a renewing-but-hidden page leased; a frozen or vanished client // gives the pane back within two minutes instead of half a minute, and a // closing client is still released immediately through ReleaseClient. LeaseTTL = 120 * time.Second // ReleaseGrace keeps a released width in place for a moment. Leaving a // terminal on the phone and stepping back into it is a few seconds apart, // and restoring the pane in between resizes it twice: the agent re-renders // on both SIGWINCHs, so its output looks stalled for as long as it repaints. // The pane keeping the phone's width this much longer is the cheaper trade. ReleaseGrace = 10 * time.Second )
Variables ¶
var ( ErrClosed = errors.New("Pane size leasing is shut down") ErrInvalidColumns = errors.New("Columns must be between 40 and 240") ErrInvalidRows = errors.New("Rows must be between 10 and 120") ErrInvalidLease = errors.New("Pane and lease owner are required") ErrLeaseOwnerGone = errors.New("Pane size lease owner is disconnected") ErrResizeFailed = errors.New("Pane terminal size could not be changed") ErrUnsupportedOS = errors.New("Pane size leasing is unsupported on this platform") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(provider ProcessInfoProvider, logger *slog.Logger) *Manager
func (*Manager) ActiveColumns ¶ added in v0.14.2
ActiveColumns reports the narrowest unexpired lease for a pane.
func (*Manager) ActiveRows ¶ added in v0.14.8
ActiveRows reports the effective terminal height for an actively leased pane: the smallest unexpired row lease, or the pane's baseline height when no client leases rows.
func (*Manager) Release ¶
Release lapses the lease instead of restoring the pane immediately. A phone that returns to the terminal within ReleaseGrace re-acquires the width it already has, so nothing is resized and the agent does not re-render; the expiry sweep restores the pane once the grace elapses. A disconnecting client keeps the immediate path through ReleaseClient.
func (*Manager) ReleaseClient ¶
func (*Manager) ResizedWithin ¶ added in v0.15.7
ResizedWithin reports whether a lease actually changed the pane's terminal width within the given window. Renewals that keep the same columns do not count: they do not signal the application, so it does not re-render.