Documentation
¶
Overview ¶
Package plugins implements the Go native plugin (.so) loading system for DevClaw. Plugins extend the runtime with additional channels, webhooks, and custom integrations without recompiling the binary.
Plugin .so files must export one of:
- var Channel channels.Channel (for channel plugins)
- var Plugin plugins.Plugin (for generic plugins)
Build a plugin:
go build -buildmode=plugin -o plugins/discord.so discord_plugin.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Dir is the directory to scan for .so files.
Dir string `yaml:"dir"`
// Enabled lists plugins to load (empty = load all found).
Enabled []string `yaml:"enabled"`
// Disabled lists plugins to skip.
Disabled []string `yaml:"disabled"`
}
Config holds plugin loader configuration.
type LoadedPlugin ¶
type LoadedPlugin struct {
// Path is the .so file path.
Path string
// Name is the plugin name (from filename or Plugin.Name()).
Name string
// Channel is the channel implementation (if this is a channel plugin).
Channel channels.Channel
// Plugin is the generic plugin interface (optional).
Plugin Plugin
// Raw is the raw *plugin.Plugin handle.
Raw *plugin.Plugin
}
LoadedPlugin holds a loaded plugin and its metadata.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader discovers and loads Go native plugins from a directory.
func (*Loader) RegisterChannels ¶
RegisterChannels registers all loaded channel plugins with a Manager.
type Plugin ¶
type Plugin interface {
// Name returns the plugin identifier.
Name() string
// Version returns the plugin version string.
Version() string
// Init is called after loading. Use for setup.
Init(ctx context.Context, config map[string]any) error
// Shutdown is called on graceful stop.
Shutdown() error
}
Plugin is the interface for generic DevClaw plugins. Channel plugins can also implement this for lifecycle hooks, but it's not required — exporting var Channel is enough.