// Package plugin defines the plugin system for the Orca framework. // // All extensions to the framework (skills, tools, LLM drivers, etc.) // are implemented as plugins that implement the Plugin interface. // The kernel manages plugin lifecycle: load, init, start, stop, shutdown. package plugin import "github.com/orca/orca/pkg/bus" // PluginState represents the current lifecycle state of a plugin. type PluginState int const ( StateUnknown PluginState = iota StateRegistered StateInitialized StateRunning StateStopped StateError ) func (ps PluginState) String() string { switch ps { case StateUnknown: return "unknown" case StateRegistered: return "registered" case StateInitialized: return "initialized" case StateRunning: return "running" case StateStopped: return "stopped" case StateError: return "error" default: return "unknown" } } // PluginHost is the interface that the kernel provides to plugins. // // Plugins receive a PluginHost reference during Init() to interact // with the framework: publishing/subscribing to messages, discovering // other plugins, and accessing shared resources. type PluginHost interface { Bus() bus.MessageBus GetPlugin(name string) (Plugin, bool) ListPlugins() []Plugin } // Plugin defines the interface that all Orca plugins must implement. type Plugin interface { Name() string Version() string Init(host PluginHost) error Shutdown() error }