plugins

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePluginRequest

type CreatePluginRequest struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Description  string            `json:"description"`
	Version      string            `json:"version,omitempty"`
	Author       string            `json:"author,omitempty"`
	Scope        string            `json:"scope,omitempty"` // "workspace" or "global"
	SystemPrompt string            `json:"system_prompt,omitempty"`
	Tools        []PluginToolDef   `json:"tools,omitempty"`
	Skills       []PluginSkillDef  `json:"skills,omitempty"`
	Files        map[string]string `json:"files,omitempty"` // filename -> content
}

CreatePluginRequest is the payload used by the agent or UI to create a new plugin.

type Executor

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

Executor runs plugin tools safely with timeouts and workspace context.

func NewExecutor

func NewExecutor(inspector ...Inspector) *Executor

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, p *Plugin, tool *PluginToolDef, args map[string]interface{}, workspaceDir string) (*PluginToolResult, error)

Execute runs a plugin tool with the provided arguments and context.

func (*Executor) SetInspector

func (e *Executor) SetInspector(inspector Inspector)

SetInspector sets or updates the inspector interface.

type HandlerType

type HandlerType string

HandlerType specifies how a plugin tool executes.

const (
	HandlerCommand HandlerType = "command" // Executes a shell command template
	HandlerScript  HandlerType = "script"  // Executes a script file in the plugin directory
	HandlerInline  HandlerType = "inline"  // Built-in or inline code
)

type Inspector

type Inspector interface {
	List() []*Plugin
	ActiveTools() []PluginToolWithPlugin
	ActiveSkills() []PluginSkillWithPlugin
	ActiveSystemPrompts() []string
}

Inspector allows components like Executor to inspect live runtime plugin state.

type Manager

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

func NewManager

func NewManager(dataDir string, bus *events.Bus) *Manager

func (*Manager) ActiveSkills

func (m *Manager) ActiveSkills() []PluginSkillWithPlugin

ActiveSkills returns all skills contributed by enabled plugins.

func (*Manager) ActiveSystemPrompts

func (m *Manager) ActiveSystemPrompts() []string

ActiveSystemPrompts returns system prompts from all enabled plugins.

func (*Manager) ActiveTools

func (m *Manager) ActiveTools() []PluginToolWithPlugin

ActiveTools returns all tools provided by currently enabled plugins.

func (*Manager) CreatePlugin

func (m *Manager) CreatePlugin(req CreatePluginRequest, activeWorkspace string) (*Plugin, error)

CreatePlugin creates a plugin on disk and registers it immediately.

func (*Manager) DeletePlugin

func (m *Manager) DeletePlugin(id string) error

DeletePlugin deletes a plugin from disk and unregisters it.

func (*Manager) ExecuteTool

func (m *Manager) ExecuteTool(ctx context.Context, pluginID string, toolName string, args map[string]interface{}, workspaceDir string) (*PluginToolResult, error)

ExecuteTool dispatches execution of a plugin tool.

func (*Manager) Get

func (m *Manager) Get(id string) (*Plugin, bool)

Get returns a plugin by ID.

func (*Manager) List

func (m *Manager) List() []*Plugin

List returns all discovered and registered plugins.

func (*Manager) Register

func (m *Manager) Register(p *Plugin) error

Register registers an in-memory or runtime plugin.

func (*Manager) Reload

func (m *Manager) Reload()

Reload scans the global and workspace plugin directories.

func (*Manager) SetWorkspace

func (m *Manager) SetWorkspace(dir string)

func (*Manager) TogglePlugin

func (m *Manager) TogglePlugin(id string, enabled bool) error

TogglePlugin toggles the enabled state of a plugin.

type Plugin

type Plugin struct {
	ID           string           `json:"id"`
	Name         string           `json:"name"`
	Description  string           `json:"description"`
	Version      string           `json:"version"`
	Author       string           `json:"author,omitempty"`
	Enabled      bool             `json:"enabled"`
	Source       PluginSource     `json:"source"`
	Path         string           `json:"path,omitempty"` // Path to plugin.json
	Dir          string           `json:"dir,omitempty"`  // Directory holding plugin files
	SystemPrompt string           `json:"system_prompt,omitempty"`
	Tools        []PluginToolDef  `json:"tools,omitempty"`
	Skills       []PluginSkillDef `json:"skills,omitempty"`
	CreatedAt    time.Time        `json:"created_at,omitempty"`
	UpdatedAt    time.Time        `json:"updated_at,omitempty"`

	// Cordis runtime state (cordis.yml compositions only).
	CordisState  string   `json:"cordis_state,omitempty"` // ACTIVE|PENDING|FAILED|UNLOADING|DISPOSED
	CordisError  string   `json:"cordis_error,omitempty"` // apply/config failure detail
	CordisInject []string `json:"cordis_inject,omitempty"`
}

Plugin represents a registered or discovered agent plugin.

type PluginSkillDef

type PluginSkillDef struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Body        string `json:"body"`
}

PluginSkillDef defines a skill bundled within a plugin.

type PluginSkillWithPlugin

type PluginSkillWithPlugin struct {
	PluginID string
	Skill    PluginSkillDef
}

PluginSkillWithPlugin pairs a bundled skill with its parent plugin ID.

type PluginSource

type PluginSource string

PluginSource indicates where the plugin was discovered or created.

const (
	SourceWorkspace PluginSource = "workspace"
	SourceGlobal    PluginSource = "global"
	SourceRuntime   PluginSource = "runtime"
	SourceBuiltin   PluginSource = "builtin"
)

type PluginToolDef

type PluginToolDef struct {
	Name           string                 `json:"name"`
	Description    string                 `json:"description"`
	Parameters     map[string]interface{} `json:"parameters,omitempty"`
	HandlerType    HandlerType            `json:"handler_type"`
	Command        string                 `json:"command,omitempty"`
	Script         string                 `json:"script,omitempty"`
	TimeoutSeconds int                    `json:"timeout_seconds,omitempty"`
}

PluginToolDef defines a tool exposed by a plugin to the agent.

type PluginToolResult

type PluginToolResult struct {
	Stdout   string `json:"stdout,omitempty"`
	Stderr   string `json:"stderr,omitempty"`
	ExitCode int    `json:"exit_code"`
	Success  bool   `json:"success"`
	Error    string `json:"error,omitempty"`
}

PluginToolResult is returned after executing a plugin tool.

type PluginToolWithPlugin

type PluginToolWithPlugin struct {
	PluginID string
	Tool     PluginToolDef
}

PluginToolWithPlugin pairs an exposed tool with its parent plugin ID.

Jump to

Keyboard shortcuts

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