plugins

package
v0.0.0-...-ba13dd4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager loads, categorizes, and manages the lifecycle of plugins.

func NewManager

func NewManager(pluginDir string, broadcast chan<- any) *Manager

NewManager creates a plugin manager that loads plugins from pluginDir.

func (*Manager) ApplyProjectStates

func (m *Manager) ApplyProjectStates(states map[string][]byte) []string

ApplyProjectStates is the ProjectStatefulPlugin analogue of ApplyUserStates.

func (*Manager) ApplyUserStates

func (m *Manager) ApplyUserStates(states map[string][]byte) []string

ApplyUserStates calls ImportUserState on each loaded UserStatefulPlugin whose name appears in states. Returns names that did not match a loaded UserStatefulPlugin so callers can preserve those blobs across round-trips.

func (*Manager) Dashboard

func (m *Manager) Dashboard() sdk.DashboardProvider

Dashboard returns the loaded dashboard plugin, or nil.

func (*Manager) ExecProviders

func (m *Manager) ExecProviders() map[string]sdk.ExecProvider

ExecProviders returns the loaded execution providers.

func (*Manager) ExportProjectStates

func (m *Manager) ExportProjectStates() map[string][]byte

ExportProjectStates is the ProjectStatefulPlugin analogue of ExportUserStates.

func (*Manager) ExportUserStates

func (m *Manager) ExportUserStates() map[string][]byte

ExportUserStates walks every loaded plugin and returns state bytes for those that implement sdk.UserStatefulPlugin. Plugins whose ExportUserState panics or errors are skipped with a log line; the returned map only contains successful exports.

func (*Manager) Features

func (m *Manager) Features() map[string]sdk.TabProvider

Features returns the loaded plugin features (sub-tabs).

func (*Manager) GraphData

func (m *Manager) GraphData(ctx context.Context) map[string]sdk.GraphInfo

GraphData collects network graph data from all connected ExecProviders that implement GraphProvider. Returns a map keyed by provider name.

func (*Manager) HasPlugins

func (m *Manager) HasPlugins() bool

HasPlugins returns true if any plugins are loaded.

func (*Manager) InteractProviders

func (m *Manager) InteractProviders() map[string]sdk.InteractProvider

InteractProviders returns the loaded Interact-tab OOB plugins.

func (*Manager) List

func (m *Manager) List() []PluginInfo

List returns info about all loaded plugins.

func (*Manager) PluginDir

func (m *Manager) PluginDir() string

PluginDir returns the directory where plugin .so/.dylib files are stored.

func (*Manager) ProxyHooks

func (m *Manager) ProxyHooks() []sdk.ProxyHook

ProxyHooks returns the loaded proxy hooks in load order.

func (*Manager) RunRequestHook

func (m *Manager) RunRequestHook(ctx context.Context, info sdk.RequestInfo, rawReq []byte) ([]byte, error)

RunRequestHook chains all proxy hooks' OnRequest methods. Returns the (possibly modified) raw request, or nil to drop.

func (*Manager) RunResponseHook

func (m *Manager) RunResponseHook(ctx context.Context, info sdk.RequestInfo, rawResp []byte) ([]byte, error)

RunResponseHook chains all proxy hooks' OnResponse methods.

func (*Manager) Shutdown

func (m *Manager) Shutdown()

Shutdown calls Shutdown() on each loaded plugin with panic recovery.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start loads all plugins from the plugin directory, categorizes them by type, and calls Init() on each. Errors during loading or init are logged but do not prevent other plugins from loading.

func (*Manager) TabProviders

func (m *Manager) TabProviders() map[string]sdk.TabProvider

TabProviders returns the loaded top-level tab plugins.

type PluginInfo

type PluginInfo struct {
	Name     string         `json:"name"`
	Version  string         `json:"version"`
	Desc     string         `json:"description"`
	Type     sdk.PluginType `json:"type"`
	Status   string         `json:"status"` // "loaded", "error"
	Error    string         `json:"error,omitempty"`
	Hash     string         `json:"hash"`               // SHA-256 of .so file
	Filename string         `json:"filename"`           // original .so/.dylib filename
	HasGraph bool           `json:"hasGraph,omitempty"` // exec provider implements GraphProvider
	TabLabel string         `json:"tabLabel,omitempty"` // for tab/feature/dashboard types
}

PluginInfo is the API-facing summary of a loaded plugin.

Jump to

Keyboard shortcuts

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