command

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginID = "command"
)

Variables

View Source
var (
	// ErrHandlerNotFound is returned when a handler is not found.
	ErrHandlerNotFound = errors.New("handler not found")
	// ErrHandlerTimeout is returned when a handler times out.
	ErrHandlerTimeout = errors.New("handler timeout")
)

Functions

func RegisterPlugin

func RegisterPlugin(
	p *sdk.Plugin,
	opts PluginOpts,
) error

Types

type Handler

type Handler func(ctx *types.PluginContext, body []byte) ([]byte, error)

Handler is a function that processes a command called from the frontend. It is expected to return the response body as a byte slice.

type Manager

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

Manager manages the lifecycle of the terminal sessions.

func NewManager

func NewManager(
	log hclog.Logger,
	sp settings.Provider,
	handlers map[string]Handler,
) *Manager

NewManager initializes a new Manager instance.

func (*Manager) Call

func (m *Manager) Call(
	ctx *types.PluginContext,
	target string,
	payload []byte,
) ([]byte, error)

type Plugin

type Plugin struct {
	plugin.Plugin
	Impl Provider
}

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(
	_ context.Context,
	_ *plugin.GRPCBroker,
	c *grpc.ClientConn,
) (interface{}, error)

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error

type PluginClient

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

func (*PluginClient) Call

func (p *PluginClient) Call(
	ctx *types.PluginContext,
	path string,
	body []byte,
) ([]byte, error)

type PluginOpts

type PluginOpts struct {
	Handlers map[string]Handler `json:"handlers"`
}

PluginOpts contains the options for the command plugin.

type PluginServer

type PluginServer struct {
	Impl Provider
	// contains filtered or unexported fields
}

func (*PluginServer) Call

type Provider

type Provider interface {
	ProviderImpl
}

Provider is the interface satisfied by the plugin server and client to provide the general functionality.

type ProviderImpl

type ProviderImpl interface {
	Call(ctx *types.PluginContext, target string, payload []byte) ([]byte, error)
}

Jump to

Keyboard shortcuts

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