plugins

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package plugins provides a plugin registry and hook system for Forge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	Name        string
	Description string
	Tools       []ToolDefinition
	Identity    *IdentityConfig
	Model       *PluginModelConfig
	Extra       map[string]any
}

AgentConfig is the intermediate representation from a FrameworkPlugin.

type FrameworkPlugin

type FrameworkPlugin interface {
	Name() string
	DetectProject(dir string) (bool, error)
	ExtractAgentConfig(dir string) (*AgentConfig, error)
	GenerateWrapper(config *AgentConfig) ([]byte, error)
	RuntimeDependencies() []string
}

FrameworkPlugin adapts a specific agent framework to the Forge build pipeline.

type FrameworkRegistry

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

FrameworkRegistry holds framework plugins in registration order.

func NewFrameworkRegistry

func NewFrameworkRegistry() *FrameworkRegistry

NewFrameworkRegistry creates an empty FrameworkRegistry.

func (*FrameworkRegistry) Detect

func (r *FrameworkRegistry) Detect(dir string) (FrameworkPlugin, error)

Detect iterates plugins in registration order and returns the first whose DetectProject returns true. Returns nil if no plugin matches.

func (*FrameworkRegistry) Get

Get returns a plugin by name, or nil if not found.

func (*FrameworkRegistry) Register

func (r *FrameworkRegistry) Register(p FrameworkPlugin)

Register appends a framework plugin to the registry.

type HookPoint

type HookPoint string

HookPoint identifies when a plugin hook fires.

const (
	HookPreBuild  HookPoint = "pre-build"
	HookPostBuild HookPoint = "post-build"
	HookPrePush   HookPoint = "pre-push"
	HookPostPush  HookPoint = "post-push"
)

type IdentityConfig

type IdentityConfig struct {
	Role      string
	Goal      string
	Backstory string
}

IdentityConfig holds agent identity metadata extracted by a plugin.

type Plugin

type Plugin interface {
	// Name returns the unique plugin name.
	Name() string
	// Version returns the plugin version.
	Version() string
	// Init initialises the plugin with arbitrary configuration.
	Init(config map[string]any) error
	// Hooks returns the set of hook points this plugin wants to intercept.
	Hooks() []HookPoint
	// Execute runs the plugin logic for the given hook point.
	Execute(ctx context.Context, hook HookPoint, data map[string]any) error
}

Plugin is the interface that Forge plugins must implement.

type PluginModelConfig

type PluginModelConfig struct {
	Provider string
	Name     string
	Version  string
}

PluginModelConfig holds model info extracted by a plugin.

type Registry

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

Registry stores registered plugins and provides lookup.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty plugin registry.

func (*Registry) Get

func (r *Registry) Get(name string) Plugin

Get returns a plugin by name, or nil if not found.

func (*Registry) Register

func (r *Registry) Register(p Plugin) error

Register adds a plugin to the registry. It returns an error if a plugin with the same name is already registered.

type ToolDefinition

type ToolDefinition struct {
	Name        string
	Description string
	InputSchema map[string]any
}

ToolDefinition describes a tool discovered by a framework plugin.

Jump to

Keyboard shortcuts

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