Documentation
¶
Index ¶
- Constants
- type BuildOpts
- type CapabilityDetector
- type Controller
- type ExternalBackend
- func (b *ExternalBackend) DetectCapabilities() ([]string, error)
- func (b *ExternalBackend) Dispense(name string) (interface{}, error)
- func (b *ExternalBackend) Exited() bool
- func (b *ExternalBackend) Healthy() bool
- func (b *ExternalBackend) Kill()
- func (b *ExternalBackend) NegotiatedVersion() int
- func (b *ExternalBackend) ProcessExited() bool
- func (b *ExternalBackend) ProcessObservation() (devsession.ProcessObservation, error)
- func (b *ExternalBackend) ReattachConfig() *goplugin.ReattachConfig
- func (b *ExternalBackend) SetProcessCleanup(cleanup func())
- func (b *ExternalBackend) Stop() error
- type InProcessBackend
- func (b *InProcessBackend) DetectCapabilities() ([]string, error)
- func (b *InProcessBackend) Dispense(name string) (interface{}, error)
- func (b *InProcessBackend) Exited() bool
- func (b *InProcessBackend) Healthy() bool
- func (b *InProcessBackend) Kill()
- func (b *InProcessBackend) NegotiatedVersion() int
- func (b *InProcessBackend) Stop() error
- type InProcessBackendConfig
- type LifecycleController
- type NativeProviders
- type PluginBackend
- type PluginInfo
- type PluginManager
- type PluginManagerConfig
- type PluginRecord
- type PluginStateRecord
Constants ¶
const CurrentProtocolVersion = 1
CurrentProtocolVersion is the latest SDK protocol version supported by the engine. Bump this when adding a new protocol version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOpts ¶
type BuildOpts struct {
// ExcludeBackend tells the builder to not build the plugin binary. This is useful
// when we only have changes to UI components.
ExcludeBackend bool
// ExcludeUI tells the builder to not rebuild the plugin UI. This is useful
// when we only have changes to the plugin binary.
ExcludeUI bool
// GoPath defines a predefined path to the Go binary
GoPath string
// PnpmPath defines a predefined path to the PNPM binary
PnpmPath string
// NodePath defines a predefined path to the Node binary
NodePath string
}
BuildOpts specifies how a plugin should be built.
type CapabilityDetector ¶ added in v0.1.4
CapabilityDetector is an optional interface that backends can implement to report which capabilities they support.
type Controller ¶
type Controller interface {
LifecycleController
// ListPlugins returns a list of names of the plugins that are installed.
ListPlugins() ([]string, error)
// HasPlugin returns true if the plugin is registered with this controller.
HasPlugin(pluginID string) bool
}
Controller adds the current connectionless capability discovery surface.
type ExternalBackend ¶ added in v0.1.4
type ExternalBackend struct {
// contains filtered or unexported fields
}
ExternalBackend wraps a go-plugin Client and ClientProtocol pair. All go-plugin concrete types are confined to this file.
func NewExternalBackend ¶ added in v0.1.4
func NewExternalBackend(pluginClient *goplugin.Client, rpcClient goplugin.ClientProtocol) *ExternalBackend
NewExternalBackend creates a new ExternalBackend wrapping go-plugin types.
func (*ExternalBackend) DetectCapabilities ¶ added in v0.1.4
func (b *ExternalBackend) DetectCapabilities() ([]string, error)
DetectCapabilities tries lifecycle-based detection first, then falls back to gRPC method probing.
func (*ExternalBackend) Dispense ¶ added in v0.1.4
func (b *ExternalBackend) Dispense(name string) (interface{}, error)
Dispense returns a capability client by name.
func (*ExternalBackend) Exited ¶ added in v0.1.4
func (b *ExternalBackend) Exited() bool
Exited returns true if the plugin process has exited.
func (*ExternalBackend) Healthy ¶ added in v0.1.4
func (b *ExternalBackend) Healthy() bool
Healthy checks plugin health via lifecycle RPC, falling back to process exit status.
func (*ExternalBackend) Kill ¶ added in v0.1.4
func (b *ExternalBackend) Kill()
Kill forcefully terminates the plugin process.
func (*ExternalBackend) NegotiatedVersion ¶ added in v0.2.0
func (b *ExternalBackend) NegotiatedVersion() int
NegotiatedVersion returns the SDK protocol version negotiated via go-plugin.
func (*ExternalBackend) ProcessExited ¶ added in v0.21.0
func (b *ExternalBackend) ProcessExited() bool
ProcessExited checks liveness without invoking lifecycle cleanup.
func (*ExternalBackend) ProcessObservation ¶ added in v0.21.0
func (b *ExternalBackend) ProcessObservation() (devsession.ProcessObservation, error)
ProcessObservation returns the immutable post-handshake diagnostic identity. Observation failure never prevents the plugin from loading.
func (*ExternalBackend) ReattachConfig ¶ added in v0.1.4
func (b *ExternalBackend) ReattachConfig() *goplugin.ReattachConfig
ReattachConfig exposes the plugin process PID for the PID tracker.
func (*ExternalBackend) SetProcessCleanup ¶ added in v0.5.0
func (b *ExternalBackend) SetProcessCleanup(cleanup func())
SetProcessCleanup transfers a verified executable snapshot to this process's lifecycle. Configure once before publishing the backend to other goroutines.
func (*ExternalBackend) Stop ¶ added in v0.1.4
func (b *ExternalBackend) Stop() error
Stop gracefully closes the RPC connection.
type InProcessBackend ¶ added in v0.1.4
type InProcessBackend struct {
// contains filtered or unexported fields
}
InProcessBackend dispenses providers without a gRPC or process boundary. Stopping fences new access immediately; exited means shutdown has completed.
func ComposeNativeBackend ¶ added in v0.27.0
func ComposeNativeBackend(native NativeProviders) (*InProcessBackend, error)
ComposeNativeBackend binds SDK utilities to the resource provider's actual connection registry without constructing transport plugins or gRPC clients. It does not connect, start streams, or bypass host controller admission.
func NewInProcessBackend ¶ added in v0.1.4
func NewInProcessBackend(config InProcessBackendConfig) *InProcessBackend
NewInProcessBackend constructs a direct backend with immutable configuration.
func (*InProcessBackend) DetectCapabilities ¶ added in v0.1.4
func (b *InProcessBackend) DetectCapabilities() ([]string, error)
DetectCapabilities returns the names of all registered providers.
func (*InProcessBackend) Dispense ¶ added in v0.1.4
func (b *InProcessBackend) Dispense(name string) (interface{}, error)
Dispense returns the provider registered under the given name.
func (*InProcessBackend) Exited ¶ added in v0.1.4
func (b *InProcessBackend) Exited() bool
Exited reports whether aggregate shutdown has completed.
func (*InProcessBackend) Healthy ¶ added in v0.1.4
func (b *InProcessBackend) Healthy() bool
Healthy checks readiness without holding the state lock across provider code. Shutdown always overrides a custom health result.
func (*InProcessBackend) Kill ¶ added in v0.1.4
func (b *InProcessBackend) Kill()
Kill waits for Stop; in-process code cannot be forcefully terminated.
func (*InProcessBackend) NegotiatedVersion ¶ added in v0.2.0
func (b *InProcessBackend) NegotiatedVersion() int
NegotiatedVersion returns the current protocol version for in-process backends.
func (*InProcessBackend) Stop ¶ added in v0.1.4
func (b *InProcessBackend) Stop() error
Stop fences new access and waits for aggregate shutdown exactly once. Concurrent callers receive the same result after shutdown completes.
type InProcessBackendConfig ¶ added in v0.27.0
type InProcessBackendConfig struct {
// Providers are snapshotted at construction. Provider instances are not copied.
Providers map[string]interface{}
// HealthCheck optionally checks native readiness while the backend is running.
// It may run concurrently with Shutdown and must synchronize its own state.
HealthCheck func() bool
// Shutdown releases aggregate resources not owned by capability controllers.
// It runs once; it must not call Stop or Kill on this backend. The backend
// never infers resource ownership by calling Close on dispensed providers.
Shutdown func() error
}
InProcessBackendConfig defines the providers and lifetime of a direct backend. Callbacks are fixed at construction and may inspect the backend's state.
type LifecycleController ¶ added in v0.6.0
type LifecycleController interface {
// OnPluginInit is called after the plugin is loaded in to do any pre-startup initialization.
OnPluginInit(pluginID string, meta config.PluginMeta)
// OnPluginStart is called when the plugin is started.
OnPluginStart(pluginID string, meta config.PluginMeta, backend PluginBackend) error
// OnPluginStop is called when the plugin is stopped. Modules should perform any persisting of state here
OnPluginStop(pluginID string, meta config.PluginMeta) error
// OnPluginShutdown is called when the plugin is shutdown. This is the last chance to clean up any resources
// before the IDE is closed.
OnPluginShutdown(pluginID string, meta config.PluginMeta) error
// OnPluginDestroy is called when the plugin is being removed from the system. This is the last chance to
// clean up any resources associated with the plugin before it is uninstalled.
OnPluginDestroy(pluginID string, meta config.PluginMeta) error
}
LifecycleController is the manager-facing plugin lifecycle only. Resource services carry host invocation contexts independently of other capabilities.
type NativeProviders ¶ added in v0.27.0
type NativeProviders struct {
Resource resourcev2.Provider
Exec exec.Provider
Logs logs.Provider
Metric metric.Provider
Networker networker.Provider
Settings settings.Provider
Tools tools.Provider
HealthCheck func() bool
Shutdown func() error
}
NativeProviders is one activation's SDK provider graph. Construct fresh providers for each activation; never share providers between backend generations. Resource and exec controllers own Close, logs owns Close when available, networking owns StopAll, and metrics owns cancellation of its streams. Settings and tools expose no disposal contract. Shutdown owns only shared clients and other aggregate resources after all controllers have retired.
type PluginBackend ¶ added in v0.1.4
type PluginBackend interface {
// Dispense returns a capability client by name (e.g. "resource", "exec").
Dispense(name string) (interface{}, error)
// Healthy returns true if the plugin is alive and serving.
Healthy() bool
// Stop closes external RPC access or waits for direct resource shutdown.
Stop() error
// Kill forcefully terminates external backends. Direct backends wait for Stop.
Kill()
// Exited reports process exit or completion of direct backend shutdown.
Exited() bool
// NegotiatedVersion returns the SDK protocol version negotiated with this plugin.
// For InProcessBackend, returns CurrentProtocolVersion.
// For ExternalBackend, returns the go-plugin negotiated version.
NegotiatedVersion() int
}
PluginBackend abstracts access to a plugin's capability providers. ExternalBackend uses a subprocess; InProcessBackend dispatches directly.
type PluginInfo ¶ added in v0.27.0
type PluginInfo struct {
sdktypes.PluginInfo
Origin string `json:"origin"`
FrontendModule string `json:"frontendModule"`
}
PluginInfo is the host-owned, frontend-safe plugin inventory descriptor.
type PluginManager ¶
type PluginManager interface {
// OnPluginInit is called after the plugin is loaded in to do any pre-startup initialization.
OnPluginInit(ctx context.Context, pluginID string, meta config.PluginMeta) error
// OnPluginStart is called when the plugin is started.
OnPluginStart(ctx context.Context, pluginID string, meta config.PluginMeta) error
// OnPluginStop is called when the plugin is stopped. Modules should perform any persisting of state here
OnPluginStop(ctx context.Context, pluginID string, meta config.PluginMeta) error
// OnPluginShutdown is called when the plugin is shutdown. This is the last chance to clean up any resources
// before the IDE is closed.
OnPluginShutdown(ctx context.Context, pluginID string, meta config.PluginMeta) error
// OnPluginDestroy is called when the plugin is being removed from the system. This is the last chance to
// clean up any resources associated with the plugin before it is uninstalled.
OnPluginDestroy(ctx context.Context, pluginID string, meta config.PluginMeta) error
}
PluginManager must fulfil handling the event that happen during the plugin lifecycle.
type PluginManagerConfig ¶
type PluginManagerConfig struct {
// contains filtered or unexported fields
}
PluginManagerConfig is the configuration for the core plugin system.
func (*PluginManagerConfig) PluginsPath ¶
func (c *PluginManagerConfig) PluginsPath() string
PluginsPath returns the path on the filesystem to where plugins are stored.
type PluginRecord ¶ added in v0.1.4
type PluginRecord struct {
// Persisted fields.
ID string `json:"id"`
Phase lifecycle.PluginPhase `json:"phase"`
Metadata config.PluginMeta `json:"metadata"`
Enabled bool `json:"enabled"`
DevMode bool `json:"devMode"`
DevPath string `json:"devPath,omitempty"`
LastError string `json:"lastError,omitempty"`
ErrorCount int `json:"errorCount"`
InstalledAt time.Time `json:"installedAt"`
// Runtime-only fields (not persisted).
Origin string `json:"-"`
FrontendModule string `json:"-"`
StateMachine *lifecycle.PluginStateMachine `json:"-"`
Backend PluginBackend `json:"-"`
Capabilities []sdktypes.Capability `json:"-"`
ProtocolVersion int `json:"-"`
}
PluginRecord is the host-side runtime state for a managed plugin. It holds both persisted configuration and runtime-only fields.
func NewPluginRecord ¶ added in v0.1.4
func NewPluginRecord(id string, meta config.PluginMeta, initialPhase lifecycle.PluginPhase) *PluginRecord
NewPluginRecord creates a new PluginRecord with a state machine.
func (*PluginRecord) ToInfo ¶ added in v0.1.4
func (r *PluginRecord) ToInfo() PluginInfo
ToInfo converts the host-side record to a frontend-safe PluginInfo.
func (*PluginRecord) ToStateRecord ¶ added in v0.1.4
func (r *PluginRecord) ToStateRecord() PluginStateRecord
ToStateRecord converts a PluginRecord to its persistable form.
type PluginStateRecord ¶ added in v0.1.4
type PluginStateRecord struct {
ID string `json:"id"`
Phase lifecycle.PluginPhase `json:"phase"`
Metadata config.PluginMeta `json:"metadata"`
Enabled bool `json:"enabled"`
DevMode bool `json:"devMode"`
DevPath string `json:"devPath,omitempty"`
LastError string `json:"lastError,omitempty"`
ErrorCount int `json:"errorCount"`
InstalledAt time.Time `json:"installedAt"`
}
PluginStateRecord is the subset of PluginRecord that gets persisted to disk.