orca.ai/pkg/plugin/plugin.go
大森 6b94476347 Initial commit: Orca Agent Framework
Core features:
- Microkernel architecture with Actor model
- Session management with JSONL persistence
- Tool system (5 built-in tools)
- Skill system with SKILL.md parsing
- Sandbox security execution
- Ollama integration with gemma4:e4b
- Prompt-based tool calling (compatible with native function calling)
- REPL interface

11 packages, all tests passing
2026-05-08 00:55:48 +08:00

59 lines
1.4 KiB
Go

// 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
}