Versions in this module Expand all Collapse all v1 v1.54.0 Apr 28, 2026 Changes in this version + var ErrAuthRequired = errors.New("authentication required") + var ErrCapabilityMissing = errors.New("capability not supported") + var ErrInitNotification = errors.New("failed to send initialized notification") + var ErrInitTimeout = errors.New("initialize timed out") + var ErrNotStarted = errors.New("toolset not started") + var ErrServerCrashed = errors.New("server crashed") + var ErrServerUnavailable = errors.New("server unavailable") + var ErrSessionMissing = errors.New("session missing") + var ErrTransport = errors.New("transport failure") + func Classify(err error) error + func IsPermanent(err error) bool + func IsTransient(err error) bool + type Backoff struct + Initial time.Duration + Jitter float64 + Max time.Duration + Multiplier float64 + type Connector interface + Connect func(ctx context.Context) (Session, error) + type Policy struct + Backoff Backoff + Logger *slog.Logger + MaxAttempts int + OnDisconnect func(err error) + OnFailed func(err error) + OnRestart func() + Restart Restart + type Restart int + const RestartAlways + const RestartNever + const RestartOnFailure + type Session interface + Close func(ctx context.Context) error + Wait func() error + type State int32 + const StateDegraded + const StateFailed + const StateReady + const StateRestarting + const StateStarting + const StateStopped + func (s State) IsTerminal() bool + func (s State) IsUsable() bool + func (s State) String() string + type StateInfo struct + LastError error + RestartCount int + Since time.Time + State State + type Supervisor struct + func New(name string, connector Connector, policy Policy) *Supervisor + func (s *Supervisor) IsReady() bool + func (s *Supervisor) MarkReadyForTesting() + func (s *Supervisor) RestartAndWait(ctx context.Context, timeout time.Duration) error + func (s *Supervisor) Restarted() <-chan struct{} + func (s *Supervisor) Start(ctx context.Context) error + func (s *Supervisor) State() StateInfo + func (s *Supervisor) Stop(ctx context.Context) error + type Tracker struct + func NewTracker() *Tracker + func (t *Tracker) Fail(s State, err error) + func (t *Tracker) IncRestarts() int + func (t *Tracker) LastError() error + func (t *Tracker) ResetRestarts() + func (t *Tracker) Set(s State) + func (t *Tracker) Snapshot() StateInfo + func (t *Tracker) State() State