Documentation
¶
Index ¶
- Variables
- func CmuxDegradedOwnershipKey(inventory TargetInventory, err error) (string, bool)
- type Adapter
- type Cmux
- func (c Cmux) Discover(_ context.Context) (string, error)
- func (c Cmux) Inject(ctx context.Context, target string, payload string) error
- func (c Cmux) Inventory(ctx context.Context, _ OwnershipContext) (TargetInventory, error)
- func (Cmux) Name() string
- func (Cmux) NormalizeTarget(target string) (string, error)
- func (c Cmux) Probe(ctx context.Context, target string) error
- type CommandRunner
- type Discoverer
- type ExecRunner
- type File
- type Ghostty
- func (g Ghostty) Discover(ctx context.Context) (string, error)
- func (g Ghostty) Inject(ctx context.Context, target string, payload string) error
- func (Ghostty) Name() string
- func (Ghostty) NormalizeTarget(target string) (string, error)
- func (g Ghostty) Probe(ctx context.Context, target string) error
- type InventoryProvider
- type OwnershipContext
- type Registry
- type TargetInventory
- type TargetNormalizer
Constants ¶
This section is empty.
Variables ¶
var ( ErrTargetNotFound = errors.New("adapter target not found") // ErrTargetDegraded means an adapter could not safely establish physical // ownership. Supervisors must retry without mutating durable registry // bookkeeping because the uncertainty may be transient. ErrTargetDegraded = errors.New("adapter target ownership degraded") )
Functions ¶
func CmuxDegradedOwnershipKey ¶ added in v0.59.1
func CmuxDegradedOwnershipKey(inventory TargetInventory, err error) (string, bool)
CmuxDegradedOwnershipKey returns a physical key only when the error came from the same concrete cmux inventory type used for the candidate lookup. This prevents generic or third-party TargetInventory implementations from turning ErrTargetDegraded into permission to skip an uncertain owner.
Types ¶
type Cmux ¶
type Cmux struct {
Runner CommandRunner
Path string
Getenv func(string) string
LookPath func(string) (string, error)
UserHomeDir func() (string, error)
IsExecutable func(string) bool
Sleep func(context.Context, time.Duration) error
SettleDelay time.Duration
// LiveTTYOwnerCount reports how many live (non-zombie) processes hold the
// device at devPath as their controlling terminal. Defaults to the darwin
// sysctl implementation; tests inject a fake so they never run a real
// sysctl against fixture tty names.
LiveTTYOwnerCount func(devPath string) (int, error)
// Logf receives non-fatal diagnostics (evictions, degraded fail-closed
// ttys). Nil is a no-op.
Logf func(format string, args ...any)
// contains filtered or unexported fields
}
func (Cmux) Inventory ¶
func (c Cmux) Inventory(ctx context.Context, _ OwnershipContext) (TargetInventory, error)
type CommandRunner ¶
type ExecRunner ¶
type ExecRunner struct{}
type File ¶
type File struct{}
func (File) NormalizeTarget ¶
NormalizeTarget resolves a file target to its stable absolute pathname. Registration persists this value, so a later launchd invocation cannot reinterpret a relative target from a different working directory. Resolving existing symlinks also keeps lexical and symlink aliases from claiming the same destination independently.
type InventoryProvider ¶
type InventoryProvider interface {
Inventory(ctx context.Context, own OwnershipContext) (TargetInventory, error)
}
InventoryProvider lets the supervisor inventory an adapter once per pass instead of spawning one probe process for every registry entry. The OwnershipContext lets the registration preflight pass a trusted-live candidate; other callers pass the zero value.
type OwnershipContext ¶
type OwnershipContext struct {
// TrustedTarget is the adapter-native target string (e.g. a cmux surface
// target) the caller has proven live. Empty means no trusted candidate.
TrustedTarget string
}
OwnershipContext carries optional trust the caller has already established about a candidate target. Only the registration preflight may populate it: the target it is registering was discovered from the live local surface, so it is live by construction and can break an otherwise-ambiguous physical ownership tie. Supervisor and inject passes pass the zero value, which trusts nothing.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func DefaultRegistry ¶
func DefaultRegistry() Registry
func DefaultRegistryWithLogf ¶
DefaultRegistryWithLogf returns the production adapter set with non-fatal adapter diagnostics wired to logf. Callers that do not own a diagnostic stream can continue using DefaultRegistry.
func NewRegistry ¶
type TargetInventory ¶
type TargetInventory interface {
Probe(target string) error
OwnershipKey(target string) (string, error)
}
TargetInventory is a point-in-time existence snapshot. Implementations must return ErrTargetNotFound only when absence is proven by the snapshot; parse, transport, and permission failures remain ambiguous errors. When ownership is degraded, callers remain fail-closed unless a concrete adapter-specific capability proves that the same immutable inventory also established a different physical identity. The generic interface deliberately exposes no constructor for such a capability.