pluginhost

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	GetPluginPath() string
	GetLogFileRootDir() string
	GetLaunchWaitTimeoutMS() int
	GetTotalLaunchWaitTimeoutMS() int
	IsEnabled() bool
}

Config defines configuration for the plugin host.

type DefaultConfig

type DefaultConfig struct {
	// contains filtered or unexported fields
}

DefaultConfig provides environment-based configuration with LSP client overrides.

func NewDefaultConfig

func NewDefaultConfig() *DefaultConfig

NewDefaultConfig creates a new DefaultConfig instance.

func (*DefaultConfig) GetLaunchWaitTimeoutMS

func (c *DefaultConfig) GetLaunchWaitTimeoutMS() int

GetLaunchWaitTimeoutMS returns the timeout in milliseconds for waiting for a single plugin to register with the host.

func (*DefaultConfig) GetLogFileRootDir

func (c *DefaultConfig) GetLogFileRootDir() string

GetLogFileRootDir returns the root directory for plugin log files, with LSP client override taking precedence over the shared environment variable used by the deploy engine, falling back to a sensible OS-specific default.

func (*DefaultConfig) GetPluginPath

func (c *DefaultConfig) GetPluginPath() string

GetPluginPath returns the plugin path, with LSP client override taking precedence over the shared environment variable used by deploy engine and plugin-docgen.

func (*DefaultConfig) GetTotalLaunchWaitTimeoutMS

func (c *DefaultConfig) GetTotalLaunchWaitTimeoutMS() int

GetTotalLaunchWaitTimeoutMS returns the timeout in milliseconds for waiting for all plugins to register with the host.

func (*DefaultConfig) IsEnabled

func (c *DefaultConfig) IsEnabled() bool

IsEnabled returns whether plugin loading is enabled, with LSP client override taking precedence over the environment variable.

func (*DefaultConfig) WithInitOptions

func (c *DefaultConfig) WithInitOptions(opts *InitializationOptions) *DefaultConfig

WithInitOptions applies LSP client configuration from initializationOptions.

type DiagnosticsInitOptions

type DiagnosticsInitOptions struct {
	ShowAnyTypeWarnings *bool `json:"showAnyTypeWarnings,omitempty"`
}

DiagnosticsInitOptions holds diagnostic-related initialization options.

type InitializationOptions

type InitializationOptions struct {
	Plugins     *PluginInitOptions      `json:"plugins,omitempty"`
	Diagnostics *DiagnosticsInitOptions `json:"diagnostics,omitempty"`
}

InitializationOptions represents the LSP initializationOptions from the client.

type LoadDependencies

type LoadDependencies struct {
	Executor         plugin.PluginExecutor
	InstanceFactory  pluginservicev1.PluginFactory
	PluginHostConfig Config
}

LoadDependencies holds the required dependencies to set up the plugin host.

type PluginInitOptions

type PluginInitOptions struct {
	Enabled        *bool   `json:"enabled,omitempty"`
	PluginPath     *string `json:"pluginPath,omitempty"`
	LogFileRootDir *string `json:"logFileRootDir,omitempty"`
}

PluginInitOptions holds plugin-specific initialization options.

type Service

type Service interface {
	// LoadPlugins loads plugins and returns a map of plugin names to their
	// implementations that can be used with the blueprint framework.
	LoadPlugins(ctx context.Context) (*plugin.PluginMaps, error)
	// Manager returns the underlying manager for the plugin host service.
	Manager() pluginservicev1.Manager
	// Close the plugin host service and cleans up resources used by the plugin host.
	Close()
}

Service provides an interface for a plugin host in the language server.

func LoadDefaultService

func LoadDefaultService(
	dependencies *LoadDependencies,
	opts ...ServiceOption,
) (Service, error)

LoadDefaultService creates a new plugin host service using the gRPC plugin framework.

type ServiceOption

type ServiceOption func(*serviceImpl)

ServiceOption is a function that configures the plugin host service.

func WithIDGenerator

func WithIDGenerator(idGenerator core.IDGenerator) ServiceOption

WithIDGenerator sets the ID generator for the host.

func WithInitialProviders

func WithInitialProviders(providers map[string]provider.Provider) ServiceOption

WithInitialProviders sets initial providers available to plugins via the function registry.

func WithPluginServiceListener

func WithPluginServiceListener(listener net.Listener) ServiceOption

WithPluginServiceListener sets the network listener for the gRPC plugin service.

func WithServiceFS

func WithServiceFS(fs afero.Fs) ServiceOption

WithServiceFS sets the file system to be used by the plugin host service.

func WithServiceLogger

func WithServiceLogger(logger core.Logger) ServiceOption

WithServiceLogger sets the logger to be used by the plugin host service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL