Documentation
¶
Overview ¶
Package plugin implements Console's out-of-process plugin system using hashicorp/go-plugin over gRPC. The host (the console binary) launches a plugin executable, performs a handshake, and dispenses a typed client that satisfies the corresponding core interface — so engines stay unaware that an implementation lives in another process.
This package currently implements the storage seam (store.Store); other seams follow the same shape.
Index ¶
- Constants
- Variables
- func LLMPluginSet(impl llm.Provider) goplugin.PluginSet
- func LoadLLM(path string) (llm.Provider, func() error, error)
- func LoadNotifier(path string) (notify.Notifier, func() error, error)
- func LoadStatusProvider(path string) (status.Provider, func() error, error)
- func LoadStore(path string) (store.Store, error)
- func NotifierPluginSet(impl notify.Notifier) goplugin.PluginSet
- func PluginSet(impl store.Store) goplugin.PluginSet
- func Serve(impl store.Store)
- func ServeLLM(impl llm.Provider)
- func ServeNotifier(impl notify.Notifier)
- func ServeStatusProvider(impl status.Provider)
- func StatusProviderPluginSet(impl status.Provider) goplugin.PluginSet
- type LLMPlugin
- type NotifierPlugin
- type StatusProviderPlugin
- type StorePlugin
Constants ¶
const LLMPluginName = "llm"
LLMPluginName is the dispense key for the LLM seam.
const NotifierPluginName = "notifier"
NotifierPluginName is the dispense key for the notify seam.
const StatusProviderPluginName = "status_provider"
StatusProviderPluginName is the dispense key for the status seam.
const StorePluginName = "store"
StorePluginName is the dispense key for the storage seam.
Variables ¶
var Handshake = goplugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "CONSOLE_PLUGIN",
MagicCookieValue: "console-plugin-v1",
}
Handshake is shared by host and plugin; a mismatch makes go-plugin refuse to run the binary, guarding against accidentally executing a non-plugin.
Functions ¶
func LLMPluginSet ¶
LLMPluginSet returns the go-plugin set for an LLM implementation.
func LoadLLM ¶
LoadLLM launches the LLM plugin executable at path and returns an llm.Provider backed by it over gRPC. The returned func stops the subprocess. The plugin inherits the host's environment.
func LoadNotifier ¶
LoadNotifier launches the notifier-plugin executable at path and returns a notify.Notifier backed by it over gRPC. The returned func stops the subprocess. The plugin inherits the host's environment.
func LoadStatusProvider ¶
LoadStatusProvider launches the status-provider plugin executable at path and returns a status.Provider backed by it over gRPC. The returned func stops the subprocess. The plugin inherits the host's environment.
func LoadStore ¶
LoadStore launches the store-plugin executable at path and returns a store.Store backed by it over gRPC. Closing the returned store stops the subprocess. The plugin inherits the host's environment (so configuration such as CONSOLE_DB reaches it).
func NotifierPluginSet ¶
NotifierPluginSet returns the go-plugin set for a notifier implementation.
func PluginSet ¶
PluginSet returns the go-plugin plugin set for a store implementation. With a nil impl it is suitable for the host (dispensing a client); with a real impl it is suitable for the plugin (serving it).
func Serve ¶
Serve runs a store implementation as a plugin. Plugin executables call this from main; it blocks until the host disconnects.
func ServeLLM ¶
ServeLLM runs an LLM implementation as a plugin. Plugin executables call this from main; it blocks until the host disconnects.
func ServeNotifier ¶
ServeNotifier runs a notifier implementation as a plugin. Plugin executables call this from main; it blocks until the host disconnects.
func ServeStatusProvider ¶
ServeStatusProvider runs a status-provider implementation as a plugin. Plugin executables call this from main; it blocks until the host disconnects.
Types ¶
type LLMPlugin ¶
type LLMPlugin struct {
goplugin.NetRPCUnsupportedPlugin
Impl llm.Provider
}
LLMPlugin is the go-plugin GRPCPlugin for the LLM seam. On the plugin side Impl holds the real provider; on the host side it is nil and GRPCClient returns a client adapter.
func (*LLMPlugin) GRPCClient ¶
func (p *LLMPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
GRPCClient returns an llm.Provider backed by the connection (host side).
func (*LLMPlugin) GRPCServer ¶
GRPCServer registers the LLM service backed by Impl (plugin side).
type NotifierPlugin ¶
type NotifierPlugin struct {
goplugin.NetRPCUnsupportedPlugin
Impl notify.Notifier
}
NotifierPlugin is the go-plugin GRPCPlugin for the notify seam.
func (*NotifierPlugin) GRPCClient ¶
func (p *NotifierPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
GRPCClient returns a notify.Notifier backed by the connection (host side).
func (*NotifierPlugin) GRPCServer ¶
func (p *NotifierPlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error
GRPCServer registers the notifier service backed by Impl (plugin side).
type StatusProviderPlugin ¶
type StatusProviderPlugin struct {
goplugin.NetRPCUnsupportedPlugin
Impl status.Provider
}
StatusProviderPlugin is the go-plugin GRPCPlugin for the status seam. On the plugin side Impl holds the real provider; on the host side it is nil and GRPCClient returns a client adapter.
func (*StatusProviderPlugin) GRPCClient ¶
func (p *StatusProviderPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
GRPCClient returns a status.Provider backed by the connection (host side).
func (*StatusProviderPlugin) GRPCServer ¶
func (p *StatusProviderPlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error
GRPCServer registers the status-provider service backed by Impl (plugin side).
type StorePlugin ¶
type StorePlugin struct {
goplugin.NetRPCUnsupportedPlugin
Impl store.Store
}
StorePlugin is the go-plugin GRPCPlugin for the storage seam. On the plugin side Impl holds the real store; on the host side it is nil and GRPCClient returns a client adapter.
func (*StorePlugin) GRPCClient ¶
func (p *StorePlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, c *grpc.ClientConn) (any, error)
GRPCClient returns a store.Store backed by the gRPC connection (host side).
func (*StorePlugin) GRPCServer ¶
func (p *StorePlugin) GRPCServer(_ *goplugin.GRPCBroker, s *grpc.Server) error
GRPCServer registers the store service backed by Impl (plugin side).