plugin

package
v0.0.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package plugin provides plugin utilities for the tool adapter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDiscoverAndLoad

func AutoDiscoverAndLoad(adapter *adapter.ToolAdapter, pluginDir, configDir string) error

AutoDiscoverAndLoad auto-discovers and loads all plugins

func ExportPlugin

func ExportPlugin(plugin adapter.PluginLoader, outputPath string) error

ExportPlugin exports a plugin to a JSON manifest

func ListAvailablePlugins

func ListAvailablePlugins(pluginDir, configDir string) ([]string, error)

ListAvailablePlugins lists all available plugins in the directories

func MakePluginFromFunc

func MakePluginFromFunc(name, version, description string, fn interface{}) adapter.PluginLoader

Helper to create plugin from function

func ValidatePluginConfig

func ValidatePluginConfig(config PluginConfig) error

ValidatePluginConfig validates a plugin configuration

Types

type BuiltinConfig

type BuiltinConfig struct {
	Module string `json:"module"` // e.g., "tools.read"
	Symbol string `json:"symbol"` // e.g., "ReadTool"
}

type ExecPluginWrapper

type ExecPluginWrapper struct{}

ExecPluginWrapper

func (*ExecPluginWrapper) Execute

func (p *ExecPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*ExecPluginWrapper) HealthCheck

func (p *ExecPluginWrapper) HealthCheck() error

func (*ExecPluginWrapper) Initialize

func (p *ExecPluginWrapper) Initialize(config map[string]interface{}) error

func (*ExecPluginWrapper) PluginInfo

func (p *ExecPluginWrapper) PluginInfo() adapter.PluginInfo

func (*ExecPluginWrapper) Shutdown

func (p *ExecPluginWrapper) Shutdown() error

type ExternalConfig

type ExternalConfig struct {
	Command   string   `json:"command"`
	Args      []string `json:"args,omitempty"`
	Env       []string `json:"env,omitempty"`
	Stdin     bool     `json:"stdin"`
	Transport string   `json:"transport"` // "stdio", "websocket", "http"
	Endpoint  string   `json:"endpoint,omitempty"`
}

type JSONPluginLoader

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

JSONPluginLoader loads plugins from JSON configuration files

func NewJSONPluginLoader

func NewJSONPluginLoader(adapter *adapter.ToolAdapter, configDir string) *JSONPluginLoader

NewJSONPluginLoader creates a new JSON plugin loader

func (*JSONPluginLoader) LoadAllPlugins

func (l *JSONPluginLoader) LoadAllPlugins() error

LoadAllPlugins loads all JSON plugins from the config directory

func (*JSONPluginLoader) LoadPlugin

func (l *JSONPluginLoader) LoadPlugin(filePath string) error

LoadPlugin loads a plugin from a JSON config file

type MemoryPluginWrapper

type MemoryPluginWrapper struct{}

MemoryPluginWrapper

func (*MemoryPluginWrapper) Execute

func (p *MemoryPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*MemoryPluginWrapper) HealthCheck

func (p *MemoryPluginWrapper) HealthCheck() error

func (*MemoryPluginWrapper) Initialize

func (p *MemoryPluginWrapper) Initialize(config map[string]interface{}) error

func (*MemoryPluginWrapper) PluginInfo

func (p *MemoryPluginWrapper) PluginInfo() adapter.PluginInfo

func (*MemoryPluginWrapper) Shutdown

func (p *MemoryPluginWrapper) Shutdown() error

type PluginConfig

type PluginConfig struct {
	Name        string                 `json:"name"`
	Version     string                 `json:"version"`
	Description string                 `json:"description"`
	Author      string                 `json:"author"`
	Tags        []string               `json:"tags,omitempty"`
	Type        string                 `json:"type"` // "builtin", "external", "wasm"
	Builtin     *BuiltinConfig         `json:"builtin,omitempty"`
	External    *ExternalConfig        `json:"external,omitempty"`
	Config      map[string]interface{} `json:"config,omitempty"`
}

PluginConfig represents a plugin configuration file

func CreatePluginManifest

func CreatePluginManifest(name, version, description, author string, tags []string) PluginConfig

CreatePluginManifest generates a manifest file for a plugin

type PluginLoader

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

PluginLoader loads plugins from shared libraries (.so files)

func NewPluginLoader

func NewPluginLoader(adapter *adapter.ToolAdapter, pluginDir string) *PluginLoader

NewPluginLoader creates a new plugin loader

func (*PluginLoader) LoadAllPlugins

func (l *PluginLoader) LoadAllPlugins() error

LoadAllPlugins loads all plugins from the plugin directory

func (*PluginLoader) LoadPlugin

func (l *PluginLoader) LoadPlugin(filePath string) error

LoadPlugin loads a plugin from a .so file

func (*PluginLoader) ReloadPlugin

func (l *PluginLoader) ReloadPlugin(name string, filePath string) error

ReloadPlugin reloads a plugin (unload + load)

func (*PluginLoader) UnloadPlugin

func (l *PluginLoader) UnloadPlugin(name string) error

UnloadPlugin unloads a plugin by name

type ProcessPluginWrapper

type ProcessPluginWrapper struct{}

ProcessPluginWrapper

func (*ProcessPluginWrapper) Execute

func (p *ProcessPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*ProcessPluginWrapper) HealthCheck

func (p *ProcessPluginWrapper) HealthCheck() error

func (*ProcessPluginWrapper) Initialize

func (p *ProcessPluginWrapper) Initialize(config map[string]interface{}) error

func (*ProcessPluginWrapper) PluginInfo

func (p *ProcessPluginWrapper) PluginInfo() adapter.PluginInfo

func (*ProcessPluginWrapper) Shutdown

func (p *ProcessPluginWrapper) Shutdown() error

type ReadPluginWrapper

type ReadPluginWrapper struct{}

Plugin wrappers for built-in tools

func (*ReadPluginWrapper) Execute

func (p *ReadPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*ReadPluginWrapper) HealthCheck

func (p *ReadPluginWrapper) HealthCheck() error

func (*ReadPluginWrapper) Initialize

func (p *ReadPluginWrapper) Initialize(config map[string]interface{}) error

func (*ReadPluginWrapper) PluginInfo

func (p *ReadPluginWrapper) PluginInfo() adapter.PluginInfo

func (*ReadPluginWrapper) Shutdown

func (p *ReadPluginWrapper) Shutdown() error

type TelegramPluginWrapper

type TelegramPluginWrapper struct{}

TelegramPluginWrapper

func (*TelegramPluginWrapper) Execute

func (p *TelegramPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*TelegramPluginWrapper) HealthCheck

func (p *TelegramPluginWrapper) HealthCheck() error

func (*TelegramPluginWrapper) Initialize

func (p *TelegramPluginWrapper) Initialize(config map[string]interface{}) error

func (*TelegramPluginWrapper) PluginInfo

func (p *TelegramPluginWrapper) PluginInfo() adapter.PluginInfo

func (*TelegramPluginWrapper) Shutdown

func (p *TelegramPluginWrapper) Shutdown() error

type WebPluginWrapper

type WebPluginWrapper struct{}

WebPluginWrapper

func (*WebPluginWrapper) Execute

func (p *WebPluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*WebPluginWrapper) HealthCheck

func (p *WebPluginWrapper) HealthCheck() error

func (*WebPluginWrapper) Initialize

func (p *WebPluginWrapper) Initialize(config map[string]interface{}) error

func (*WebPluginWrapper) PluginInfo

func (p *WebPluginWrapper) PluginInfo() adapter.PluginInfo

func (*WebPluginWrapper) Shutdown

func (p *WebPluginWrapper) Shutdown() error

type WritePluginWrapper

type WritePluginWrapper struct{}

WritePluginWrapper

func (*WritePluginWrapper) Execute

func (p *WritePluginWrapper) Execute(args map[string]interface{}) (interface{}, error)

func (*WritePluginWrapper) HealthCheck

func (p *WritePluginWrapper) HealthCheck() error

func (*WritePluginWrapper) Initialize

func (p *WritePluginWrapper) Initialize(config map[string]interface{}) error

func (*WritePluginWrapper) PluginInfo

func (p *WritePluginWrapper) PluginInfo() adapter.PluginInfo

func (*WritePluginWrapper) Shutdown

func (p *WritePluginWrapper) Shutdown() error

Jump to

Keyboard shortcuts

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