Documentation
¶
Index ¶
- func RegisterBridge(sb *Sandbox)
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) HasPlugin(name string) bool
- func (m *Manager) IsPlugin(name string) bool
- func (m *Manager) LoadPlugin(cfg config.PluginConfig) error
- func (m *Manager) Publish(name string, data string) error
- func (m *Manager) StartSubscribe(name string, callback func(string)) error
- type Sandbox
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterBridge ¶
func RegisterBridge(sb *Sandbox)
RegisterBridge registers all Go bridge modules (fs, http, json, sleep, log) into the sandbox.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Lua plugin loading, subscribe, and publish lifecycle.
func NewManager ¶
NewManager creates a new plugin manager.
func (*Manager) IsPlugin ¶
IsPlugin is an alias for HasPlugin, used by the runner to distinguish plugins from Athyr topics.
func (*Manager) LoadPlugin ¶
func (m *Manager) LoadPlugin(cfg config.PluginConfig) error
LoadPlugin creates a sandbox, loads the Lua file, and registers bridge modules.
type Sandbox ¶
Sandbox wraps a Lua state with restricted library access.
func NewSandbox ¶
NewSandbox creates a sandboxed Lua state. restrict is a list of API names to block (e.g., "fs", "http.post"). Pass nil for no restrictions.
func (*Sandbox) IsRestricted ¶
IsRestricted checks if a given API call is blocked by the restriction list. Supports both module-level ("fs") and function-level ("fs.write") restrictions.