grpcplugin

package
v1.3.83 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "ggcode_tool_plugin"

PluginName is the well-known name used in go-plugin's ServeConfig.

Variables

View Source
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

type GRPCPluginConfig struct {
	Name    string
	Command []string
	Env     map[string]string
}

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

func NewManager(workDir string) *Manager

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.

type PluginStatus

type PluginStatus struct {
	Name  string
	Alive bool
	Tools []string
}

Directories

Path Synopsis
Package sdk is the Go SDK for developing ggcode gRPC plugins.
Package sdk is the Go SDK for developing ggcode gRPC plugins.

Jump to

Keyboard shortcuts

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