Documentation
¶
Index ¶
Constants ¶
const PluginName = "ggcode_tool_plugin"
PluginName is the well-known name used in go-plugin's ServeConfig.
Variables ¶
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "GGCODE_PLUGIN",
MagicCookieValue: "ggcode-grpc-plugin-v1",
}
HandshakeConfig is shared between host and plugin to prevent accidental connections between incompatible binaries.
Functions ¶
This section is empty.
Types ¶
type GRPCAdapter ¶
type GRPCAdapter struct {
// contains filtered or unexported fields
}
GRPCAdapter wraps a gRPC tool connection as a tool.Tool. One adapter = one tool. A plugin that exports N tools gets N adapters all sharing the same underlying gRPC client.
func NewGRPCAdapter ¶
func NewGRPCAdapter(client pb.ToolServiceClient, def *pb.ToolDefinition, workDir string) *GRPCAdapter
NewGRPCAdapter creates an adapter for a single tool exposed by the plugin.
func (*GRPCAdapter) Description ¶
func (a *GRPCAdapter) Description() string
func (*GRPCAdapter) Execute ¶
func (a *GRPCAdapter) Execute(ctx context.Context, input json.RawMessage) (tool.Result, error)
func (*GRPCAdapter) Name ¶
func (a *GRPCAdapter) Name() string
func (*GRPCAdapter) Parameters ¶
func (a *GRPCAdapter) Parameters() json.RawMessage
type GRPCPlugin ¶
type GRPCPlugin struct {
plugin.NetRPCUnsupportedPlugin
}
GRPCPlugin implements plugin.GRPCPlugin for the host side. It tells go-plugin how to create the gRPC client for ToolService.
func (*GRPCPlugin) GRPCClient ¶
func (p *GRPCPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*GRPCPlugin) GRPCServer ¶
func (p *GRPCPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error
type GRPCPluginConfig ¶
GRPCPluginConfig describes a single gRPC plugin from the host config.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages all gRPC plugin processes.
func NewManager ¶
NewManager creates a new gRPC plugin manager.
func (*Manager) LoadAll ¶
func (m *Manager) LoadAll(configs []GRPCPluginConfig, registry *tool.Registry) []error
LoadAll starts all configured gRPC plugins and registers their tools into the given registry.
func (*Manager) Shutdown ¶
func (m *Manager) Shutdown()
Shutdown gracefully stops all plugin processes.
func (*Manager) Status ¶
func (m *Manager) Status() []PluginStatus
Status returns the current status of all gRPC plugins.
type PluginInstance ¶
type PluginInstance struct {
Name string
Client *plugin.Client
Raw pb.ToolServiceClient
Adapters []*GRPCAdapter
}
PluginInstance tracks a single running gRPC plugin process.