Documentation
¶
Index ¶
- func CheckVersion(version, constraint string) (bool, error)
- func SaveManifest(path string, manifest *PluginManifest) error
- type APIHandler
- type BaseEnginePlugin
- func (b *BaseEnginePlugin) Capabilities() []capability.Contract
- func (b *BaseEnginePlugin) EngineManifest() *PluginManifest
- func (b *BaseEnginePlugin) ModuleFactories() map[string]ModuleFactory
- func (b *BaseEnginePlugin) ModuleSchemas() []*schema.ModuleSchema
- func (b *BaseEnginePlugin) StepFactories() map[string]StepFactory
- func (b *BaseEnginePlugin) TriggerFactories() map[string]TriggerFactory
- func (b *BaseEnginePlugin) WiringHooks() []WiringHook
- func (b *BaseEnginePlugin) WorkflowHandlers() map[string]WorkflowHandlerFactory
- type BaseNativePlugin
- func (b *BaseNativePlugin) Dependencies() []PluginDependency
- func (b *BaseNativePlugin) Description() string
- func (b *BaseNativePlugin) Name() string
- func (b *BaseNativePlugin) OnDisable(_ PluginContext) error
- func (b *BaseNativePlugin) OnEnable(_ PluginContext) error
- func (b *BaseNativePlugin) RegisterRoutes(_ *http.ServeMux)
- func (b *BaseNativePlugin) UIPages() []UIPageDef
- func (b *BaseNativePlugin) Version() string
- type CapabilityDecl
- type CompositeRegistry
- func (c *CompositeRegistry) CheckDependencies(manifest *PluginManifest) error
- func (c *CompositeRegistry) Get(name string) (*PluginEntry, bool)
- func (c *CompositeRegistry) Install(ctx context.Context, name, version string) error
- func (c *CompositeRegistry) List() []*PluginEntry
- func (c *CompositeRegistry) Local() *LocalRegistry
- func (c *CompositeRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, ...) error
- func (c *CompositeRegistry) Remote() *RemoteRegistry
- func (c *CompositeRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)
- func (c *CompositeRegistry) Unregister(name string) error
- type Constraint
- type Dependency
- type EmbeddedWorkflow
- type EnginePlugin
- type EnginePluginManager
- func (m *EnginePluginManager) Disable(name string) error
- func (m *EnginePluginManager) Enable(name string) error
- func (m *EnginePluginManager) Get(name string) (EnginePlugin, bool)
- func (m *EnginePluginManager) IsEnabled(name string) bool
- func (m *EnginePluginManager) List() []EnginePlugin
- func (m *EnginePluginManager) Loader() *PluginLoader
- func (m *EnginePluginManager) Register(p EnginePlugin) error
- func (m *EnginePluginManager) ResolveWorkflowDependencies(cfg *config.WorkflowConfig) error
- type LocalRegistry
- func (r *LocalRegistry) CheckDependencies(manifest *PluginManifest) error
- func (r *LocalRegistry) Get(name string) (*PluginEntry, bool)
- func (r *LocalRegistry) List() []*PluginEntry
- func (r *LocalRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, ...) error
- func (r *LocalRegistry) ScanDirectory(dir string, loader *dynamic.Loader) ([]*PluginEntry, error)
- func (r *LocalRegistry) Unregister(name string) error
- type MissingCapabilitiesError
- type ModuleFactory
- type NativeHandler
- type NativePlugin
- type PluginContext
- type PluginDependency
- type PluginEntry
- type PluginInfo
- type PluginLoader
- func (l *PluginLoader) CapabilityRegistry() *capability.Registry
- func (l *PluginLoader) LoadPlugin(p EnginePlugin) error
- func (l *PluginLoader) LoadPlugins(plugins []EnginePlugin) error
- func (l *PluginLoader) LoadedPlugins() []EnginePlugin
- func (l *PluginLoader) ModuleFactories() map[string]ModuleFactory
- func (l *PluginLoader) StepFactories() map[string]StepFactory
- func (l *PluginLoader) TriggerFactories() map[string]TriggerFactory
- func (l *PluginLoader) WiringHooks() []WiringHook
- func (l *PluginLoader) WorkflowHandlerFactories() map[string]WorkflowHandlerFactory
- type PluginManager
- func (pm *PluginManager) AllPlugins() []PluginInfo
- func (pm *PluginManager) Disable(name string) error
- func (pm *PluginManager) Enable(name string) error
- func (pm *PluginManager) EnabledPlugins() []NativePlugin
- func (pm *PluginManager) IsEnabled(name string) bool
- func (pm *PluginManager) Register(p NativePlugin) error
- func (pm *PluginManager) RestoreState() error
- func (pm *PluginManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (pm *PluginManager) SetContext(ctx PluginContext)
- type PluginManifest
- type PluginRegistry
- type PluginWorkflowRegistry
- type RegistryHandler
- type RemoteRegistry
- func (r *RemoteRegistry) ClearCache()
- func (r *RemoteRegistry) Download(ctx context.Context, name, version string) (io.ReadCloser, error)
- func (r *RemoteRegistry) GetManifest(ctx context.Context, name, version string) (*PluginManifest, error)
- func (r *RemoteRegistry) ListVersions(ctx context.Context, name string) ([]string, error)
- func (r *RemoteRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)
- type RemoteRegistryOption
- type Semver
- type StepFactory
- type TriggerFactory
- type UIPageDef
- type WiringHook
- type WorkflowHandlerFactory
- type WorkflowPlugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶
CheckVersion checks if a version string satisfies a constraint string.
func SaveManifest ¶
func SaveManifest(path string, manifest *PluginManifest) error
SaveManifest writes a manifest to a JSON file.
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler serves HTTP endpoints for the plugin registry.
func NewAPIHandler ¶
func NewAPIHandler(registry *LocalRegistry, loader *dynamic.Loader) *APIHandler
NewAPIHandler creates a new plugin API handler.
func (*APIHandler) RegisterRoutes ¶
func (h *APIHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers the plugin API routes on the given mux.
type BaseEnginePlugin ¶
type BaseEnginePlugin struct {
BaseNativePlugin
Manifest PluginManifest
}
BaseEnginePlugin provides no-op defaults for all EnginePlugin methods. Embed this in concrete plugin implementations to only override what you need.
func (*BaseEnginePlugin) Capabilities ¶
func (b *BaseEnginePlugin) Capabilities() []capability.Contract
Capabilities returns an empty capability list.
func (*BaseEnginePlugin) EngineManifest ¶
func (b *BaseEnginePlugin) EngineManifest() *PluginManifest
EngineManifest returns the plugin manifest.
func (*BaseEnginePlugin) ModuleFactories ¶
func (b *BaseEnginePlugin) ModuleFactories() map[string]ModuleFactory
ModuleFactories returns no module factories.
func (*BaseEnginePlugin) ModuleSchemas ¶
func (b *BaseEnginePlugin) ModuleSchemas() []*schema.ModuleSchema
ModuleSchemas returns no module schemas.
func (*BaseEnginePlugin) StepFactories ¶
func (b *BaseEnginePlugin) StepFactories() map[string]StepFactory
StepFactories returns no step factories.
func (*BaseEnginePlugin) TriggerFactories ¶
func (b *BaseEnginePlugin) TriggerFactories() map[string]TriggerFactory
TriggerFactories returns no trigger factories.
func (*BaseEnginePlugin) WiringHooks ¶
func (b *BaseEnginePlugin) WiringHooks() []WiringHook
WiringHooks returns no wiring hooks.
func (*BaseEnginePlugin) WorkflowHandlers ¶
func (b *BaseEnginePlugin) WorkflowHandlers() map[string]WorkflowHandlerFactory
WorkflowHandlers returns no workflow handler factories.
type BaseNativePlugin ¶
BaseNativePlugin provides no-op defaults for all NativePlugin methods. Embed this in concrete implementations to only override what you need.
func (*BaseNativePlugin) Dependencies ¶
func (b *BaseNativePlugin) Dependencies() []PluginDependency
func (*BaseNativePlugin) Description ¶
func (b *BaseNativePlugin) Description() string
func (*BaseNativePlugin) Name ¶
func (b *BaseNativePlugin) Name() string
func (*BaseNativePlugin) OnDisable ¶
func (b *BaseNativePlugin) OnDisable(_ PluginContext) error
func (*BaseNativePlugin) OnEnable ¶
func (b *BaseNativePlugin) OnEnable(_ PluginContext) error
func (*BaseNativePlugin) RegisterRoutes ¶
func (b *BaseNativePlugin) RegisterRoutes(_ *http.ServeMux)
func (*BaseNativePlugin) UIPages ¶
func (b *BaseNativePlugin) UIPages() []UIPageDef
func (*BaseNativePlugin) Version ¶
func (b *BaseNativePlugin) Version() string
type CapabilityDecl ¶
type CapabilityDecl struct {
Name string `json:"name" yaml:"name"`
Role string `json:"role" yaml:"role"` // "provider" or "consumer"
Priority int `json:"priority,omitempty" yaml:"priority,omitempty"`
}
CapabilityDecl declares a capability relationship for a plugin in the manifest.
type CompositeRegistry ¶
type CompositeRegistry struct {
// contains filtered or unexported fields
}
CompositeRegistry combines a local registry with a remote registry, searching both and allowing installation from the remote into local.
func NewCompositeRegistry ¶
func NewCompositeRegistry(local *LocalRegistry, remote *RemoteRegistry) *CompositeRegistry
NewCompositeRegistry creates a composite registry from a local and remote registry.
func (*CompositeRegistry) CheckDependencies ¶
func (c *CompositeRegistry) CheckDependencies(manifest *PluginManifest) error
CheckDependencies delegates to the local registry.
func (*CompositeRegistry) Get ¶
func (c *CompositeRegistry) Get(name string) (*PluginEntry, bool)
Get delegates to the local registry.
func (*CompositeRegistry) Install ¶
func (c *CompositeRegistry) Install(ctx context.Context, name, version string) error
Install downloads a plugin from the remote registry and registers it locally.
func (*CompositeRegistry) List ¶
func (c *CompositeRegistry) List() []*PluginEntry
List delegates to the local registry.
func (*CompositeRegistry) Local ¶
func (c *CompositeRegistry) Local() *LocalRegistry
Local returns the underlying local registry.
func (*CompositeRegistry) Register ¶
func (c *CompositeRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error
Register delegates to the local registry.
func (*CompositeRegistry) Remote ¶
func (c *CompositeRegistry) Remote() *RemoteRegistry
Remote returns the underlying remote registry.
func (*CompositeRegistry) Search ¶
func (c *CompositeRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)
Search checks local first, then remote, merging results with no duplicates.
func (*CompositeRegistry) Unregister ¶
func (c *CompositeRegistry) Unregister(name string) error
Unregister delegates to the local registry.
type Constraint ¶
Constraint represents a semver constraint that can check version compatibility.
func ParseConstraint ¶
func ParseConstraint(s string) (*Constraint, error)
ParseConstraint parses a constraint string like ">=1.0.0", "^2.1.0", "~1.2.0".
func (*Constraint) Check ¶
func (c *Constraint) Check(v Semver) bool
Check returns true if the given version satisfies the constraint.
type Dependency ¶
type Dependency struct {
Name string `json:"name" yaml:"name"`
Constraint string `json:"constraint" yaml:"constraint"` // semver constraint, e.g. ">=1.0.0", "^2.1"
}
Dependency declares a versioned dependency on another plugin.
type EmbeddedWorkflow ¶
type EmbeddedWorkflow struct {
Name string `json:"name"`
Description string `json:"description"`
Config *config.WorkflowConfig `json:"-"`
ConfigYAML string `json:"configYaml,omitempty"`
InputSchema map[string]schema.ConfigFieldDef `json:"inputSchema,omitempty"`
OutputSchema map[string]schema.ConfigFieldDef `json:"outputSchema,omitempty"`
}
EmbeddedWorkflow describes a workflow contributed by a plugin.
type EnginePlugin ¶
type EnginePlugin interface {
NativePlugin
// EngineManifest returns the extended plugin manifest with capability declarations.
EngineManifest() *PluginManifest
// Capabilities returns the capability contracts this plugin defines or satisfies.
Capabilities() []capability.Contract
// ModuleFactories returns module type factories.
// Key is the module type string (e.g., "http.server").
// Value is func(name string, cfg map[string]any) modular.Module
ModuleFactories() map[string]ModuleFactory
// StepFactories returns pipeline step type factories.
// Key is the step type string (e.g., "step.validate").
StepFactories() map[string]StepFactory
// TriggerFactories returns trigger type constructors.
// Key is the trigger type string (e.g., "http").
TriggerFactories() map[string]TriggerFactory
// WorkflowHandlers returns workflow handler factories.
// Key is the workflow type string (e.g., "http", "messaging").
WorkflowHandlers() map[string]WorkflowHandlerFactory
// ModuleSchemas returns UI schema definitions for this plugin's module types.
ModuleSchemas() []*schema.ModuleSchema
// WiringHooks returns post-init wiring functions.
WiringHooks() []WiringHook
}
EnginePlugin extends NativePlugin with engine-level contributions: module type factories, step type factories, trigger factories, workflow handlers, capability contracts, and wiring hooks.
type EnginePluginManager ¶
type EnginePluginManager struct {
// contains filtered or unexported fields
}
EnginePluginManager wraps the PluginLoader with lifecycle management, allowing plugins to be registered, enabled, and disabled independently.
func NewEnginePluginManager ¶
func NewEnginePluginManager(capReg *capability.Registry, schemaReg *schema.ModuleSchemaRegistry) *EnginePluginManager
NewEnginePluginManager creates a new manager backed by the given capability and schema registries.
func (*EnginePluginManager) Disable ¶
func (m *EnginePluginManager) Disable(name string) error
Disable deactivates a plugin. The plugin remains registered but its factories are no longer active. Note: a full rebuild of the loader is performed to remove the plugin's contributions.
func (*EnginePluginManager) Enable ¶
func (m *EnginePluginManager) Enable(name string) error
Enable activates a registered plugin, loading it into the PluginLoader. Returns an error if the plugin is not registered or is already enabled.
func (*EnginePluginManager) Get ¶
func (m *EnginePluginManager) Get(name string) (EnginePlugin, bool)
Get returns the plugin with the given name and a boolean indicating whether it exists.
func (*EnginePluginManager) IsEnabled ¶
func (m *EnginePluginManager) IsEnabled(name string) bool
IsEnabled returns true if the named plugin is currently enabled.
func (*EnginePluginManager) List ¶
func (m *EnginePluginManager) List() []EnginePlugin
List returns all registered plugins (enabled and disabled).
func (*EnginePluginManager) Loader ¶
func (m *EnginePluginManager) Loader() *PluginLoader
Loader returns the underlying PluginLoader for accessing aggregated factories and hooks.
func (*EnginePluginManager) Register ¶
func (m *EnginePluginManager) Register(p EnginePlugin) error
Register adds a plugin to the manager without enabling it. Returns an error if a plugin with the same name is already registered.
func (*EnginePluginManager) ResolveWorkflowDependencies ¶
func (m *EnginePluginManager) ResolveWorkflowDependencies(cfg *config.WorkflowConfig) error
ResolveWorkflowDependencies checks that all capabilities required by a workflow config are satisfied by loaded plugins. If cfg.Requires is nil, returns nil (auto-detection will be added later). For each required capability, checks capabilityReg.HasProvider(). Returns MissingCapabilitiesError if any are missing.
type LocalRegistry ¶
type LocalRegistry struct {
// contains filtered or unexported fields
}
LocalRegistry implements PluginRegistry by scanning local directories.
func NewLocalRegistry ¶
func NewLocalRegistry() *LocalRegistry
NewLocalRegistry creates a new empty local registry.
func (*LocalRegistry) CheckDependencies ¶
func (r *LocalRegistry) CheckDependencies(manifest *PluginManifest) error
CheckDependencies verifies that all dependencies declared in the manifest are satisfied by currently registered plugins.
func (*LocalRegistry) Get ¶
func (r *LocalRegistry) Get(name string) (*PluginEntry, bool)
Get retrieves a plugin entry by name.
func (*LocalRegistry) List ¶
func (r *LocalRegistry) List() []*PluginEntry
List returns all registered plugin entries.
func (*LocalRegistry) Register ¶
func (r *LocalRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error
Register adds a plugin to the registry after validating its manifest and checking version compatibility of declared dependencies.
func (*LocalRegistry) ScanDirectory ¶
func (r *LocalRegistry) ScanDirectory(dir string, loader *dynamic.Loader) ([]*PluginEntry, error)
ScanDirectory scans a directory for plugin subdirectories. Each subdirectory should contain a plugin.json manifest and a .go source file.
func (*LocalRegistry) Unregister ¶
func (r *LocalRegistry) Unregister(name string) error
Unregister removes a plugin from the registry.
type MissingCapabilitiesError ¶
type MissingCapabilitiesError struct {
Missing []string
}
MissingCapabilitiesError is returned when a workflow config requires capabilities that no loaded plugin provides.
func (*MissingCapabilitiesError) Error ¶
func (e *MissingCapabilitiesError) Error() string
type ModuleFactory ¶
ModuleFactory creates a modular.Module from a name and config map.
type NativeHandler ¶
type NativeHandler struct {
// contains filtered or unexported fields
}
NativeHandler serves HTTP endpoints for native plugin discovery and route dispatch. It delegates all behavior to the PluginManager.
func NewNativeHandler ¶
func NewNativeHandler(manager *PluginManager) *NativeHandler
NewNativeHandler creates a new handler backed by a PluginManager.
func (*NativeHandler) ServeHTTP ¶
func (h *NativeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler by delegating to the PluginManager.
type NativePlugin ¶
type NativePlugin interface {
Name() string
Version() string
Description() string
Dependencies() []PluginDependency
UIPages() []UIPageDef
RegisterRoutes(mux *http.ServeMux)
OnEnable(ctx PluginContext) error
OnDisable(ctx PluginContext) error
}
NativePlugin is a compiled-in plugin that provides HTTP handlers, UI page metadata, and lifecycle hooks with dependency declarations.
type PluginContext ¶
type PluginContext struct {
App interface{} // modular.Application — use interface{} to avoid import cycle
DB *sql.DB
Logger *slog.Logger
DataDir string
}
PluginContext provides shared resources to plugins during lifecycle events.
type PluginDependency ¶
type PluginDependency struct {
Name string `json:"name"` // required plugin name
MinVersion string `json:"minVersion"` // semver constraint, empty = any version
}
PluginDependency declares a dependency on another plugin.
type PluginEntry ¶
type PluginEntry struct {
Manifest *PluginManifest `json:"manifest"`
Component *dynamic.DynamicComponent `json:"-"`
SourceDir string `json:"source_dir,omitempty"`
}
PluginEntry holds the manifest and component for a registered plugin.
type PluginInfo ¶
type PluginInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Enabled bool `json:"enabled"`
UIPages []UIPageDef `json:"uiPages"`
Dependencies []PluginDependency `json:"dependencies"`
EnabledAt string `json:"enabledAt,omitempty"`
DisabledAt string `json:"disabledAt,omitempty"`
}
PluginInfo is the JSON representation of a plugin for API responses. JSON field names use camelCase to match the TypeScript UI conventions.
type PluginLoader ¶
type PluginLoader struct {
// contains filtered or unexported fields
}
PluginLoader loads EnginePlugins and populates registries.
func NewPluginLoader ¶
func NewPluginLoader(capReg *capability.Registry, schemaReg *schema.ModuleSchemaRegistry) *PluginLoader
NewPluginLoader creates a new PluginLoader backed by the given capability and schema registries.
func (*PluginLoader) CapabilityRegistry ¶
func (l *PluginLoader) CapabilityRegistry() *capability.Registry
CapabilityRegistry returns the loader's capability registry.
func (*PluginLoader) LoadPlugin ¶
func (l *PluginLoader) LoadPlugin(p EnginePlugin) error
LoadPlugin validates a plugin's manifest, registers its capabilities, factories, schemas, and wiring hooks. Returns an error if any factory type conflicts with an existing registration.
func (*PluginLoader) LoadPlugins ¶
func (l *PluginLoader) LoadPlugins(plugins []EnginePlugin) error
LoadPlugins performs a topological sort of plugins by their manifest dependencies, then loads each in order. Returns an error on circular dependencies or load failures.
func (*PluginLoader) LoadedPlugins ¶
func (l *PluginLoader) LoadedPlugins() []EnginePlugin
LoadedPlugins returns all successfully loaded plugins in load order.
func (*PluginLoader) ModuleFactories ¶
func (l *PluginLoader) ModuleFactories() map[string]ModuleFactory
ModuleFactories returns a defensive copy of all registered module factories.
func (*PluginLoader) StepFactories ¶
func (l *PluginLoader) StepFactories() map[string]StepFactory
StepFactories returns a defensive copy of all registered step factories.
func (*PluginLoader) TriggerFactories ¶
func (l *PluginLoader) TriggerFactories() map[string]TriggerFactory
TriggerFactories returns a defensive copy of all registered trigger factories.
func (*PluginLoader) WiringHooks ¶
func (l *PluginLoader) WiringHooks() []WiringHook
WiringHooks returns all registered wiring hooks sorted by priority (highest first).
func (*PluginLoader) WorkflowHandlerFactories ¶
func (l *PluginLoader) WorkflowHandlerFactories() map[string]WorkflowHandlerFactory
WorkflowHandlerFactories returns a defensive copy of all registered workflow handler factories.
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager handles plugin registration, dependency resolution, lifecycle management, enable/disable state persistence, and HTTP route dispatch.
func NewPluginManager ¶
func NewPluginManager(db *sql.DB, logger *slog.Logger) *PluginManager
NewPluginManager creates a new PluginManager with SQLite-backed state persistence. It initializes the plugin_state table if it does not exist.
func (*PluginManager) AllPlugins ¶
func (pm *PluginManager) AllPlugins() []PluginInfo
AllPlugins returns info about all registered plugins sorted by name.
func (*PluginManager) Disable ¶
func (pm *PluginManager) Disable(name string) error
Disable disables a plugin and all plugins that depend on it (reverse dependency order). Returns an error if the plugin is not registered.
func (*PluginManager) Enable ¶
func (pm *PluginManager) Enable(name string) error
Enable enables a plugin and all its unsatisfied dependencies (topological order). Returns an error if the plugin is not registered, if a dependency is missing, or if a circular dependency is detected.
func (*PluginManager) EnabledPlugins ¶
func (pm *PluginManager) EnabledPlugins() []NativePlugin
EnabledPlugins returns all currently enabled plugins sorted by name.
func (*PluginManager) IsEnabled ¶
func (pm *PluginManager) IsEnabled(name string) bool
IsEnabled returns whether a plugin is currently enabled.
func (*PluginManager) Register ¶
func (pm *PluginManager) Register(p NativePlugin) error
Register adds a plugin to the known set. It does not enable the plugin. Returns an error if a plugin with the same name is already registered.
func (*PluginManager) RestoreState ¶
func (pm *PluginManager) RestoreState() error
RestoreState re-enables all plugins that were previously enabled (from the plugin_state table). This is called after an engine restart or reload.
func (*PluginManager) ServeHTTP ¶
func (pm *PluginManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP dispatches HTTP requests to the correct plugin's mux. Route pattern: /api/v1/admin/plugins/{name}/{path...} Returns 404 if the plugin is not found or not enabled.
func (*PluginManager) SetContext ¶
func (pm *PluginManager) SetContext(ctx PluginContext)
SetContext sets the shared PluginContext used for OnEnable/OnDisable calls.
type PluginManifest ¶
type PluginManifest struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Author string `json:"author" yaml:"author"`
Description string `json:"description" yaml:"description"`
License string `json:"license,omitempty" yaml:"license,omitempty"`
Dependencies []Dependency `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
Contract *dynamic.FieldContract `json:"contract,omitempty" yaml:"contract,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Repository string `json:"repository,omitempty" yaml:"repository,omitempty"`
// Engine plugin declarations
Capabilities []CapabilityDecl `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`
ModuleTypes []string `json:"moduleTypes,omitempty" yaml:"moduleTypes,omitempty"`
StepTypes []string `json:"stepTypes,omitempty" yaml:"stepTypes,omitempty"`
TriggerTypes []string `json:"triggerTypes,omitempty" yaml:"triggerTypes,omitempty"`
WorkflowTypes []string `json:"workflowTypes,omitempty" yaml:"workflowTypes,omitempty"`
WiringHooks []string `json:"wiringHooks,omitempty" yaml:"wiringHooks,omitempty"`
}
PluginManifest describes a plugin's metadata, dependencies, and contract.
func LoadManifest ¶
func LoadManifest(path string) (*PluginManifest, error)
LoadManifest reads a manifest from a JSON file.
func (*PluginManifest) Validate ¶
func (m *PluginManifest) Validate() error
Validate checks that a manifest has all required fields and valid semver.
type PluginRegistry ¶
type PluginRegistry interface {
Register(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error
Unregister(name string) error
Get(name string) (*PluginEntry, bool)
List() []*PluginEntry
CheckDependencies(manifest *PluginManifest) error
}
PluginRegistry manages plugin registration and lookup.
type PluginWorkflowRegistry ¶
type PluginWorkflowRegistry struct {
// contains filtered or unexported fields
}
PluginWorkflowRegistry stores embedded workflows contributed by plugins. Workflows are keyed by qualified name: "plugin-name:workflow-name".
func NewPluginWorkflowRegistry ¶
func NewPluginWorkflowRegistry() *PluginWorkflowRegistry
NewPluginWorkflowRegistry creates an empty PluginWorkflowRegistry.
func (*PluginWorkflowRegistry) Get ¶
func (r *PluginWorkflowRegistry) Get(qualifiedName string) (*EmbeddedWorkflow, bool)
Get retrieves a workflow by its qualified name ("plugin:workflow").
func (*PluginWorkflowRegistry) List ¶
func (r *PluginWorkflowRegistry) List() []string
List returns all registered qualified workflow names, sorted.
func (*PluginWorkflowRegistry) Register ¶
func (r *PluginWorkflowRegistry) Register(pluginName string, wf EmbeddedWorkflow) error
Register adds an embedded workflow under the given plugin name.
func (*PluginWorkflowRegistry) Unregister ¶
func (r *PluginWorkflowRegistry) Unregister(pluginName string)
Unregister removes all workflows belonging to the given plugin.
type RegistryHandler ¶
type RegistryHandler struct {
// contains filtered or unexported fields
}
RegistryHandler provides HTTP API handlers for plugin management.
func NewRegistryHandler ¶
func NewRegistryHandler(registry *CompositeRegistry) *RegistryHandler
NewRegistryHandler creates a new registry handler backed by the given composite registry.
func (*RegistryHandler) RegisterRoutes ¶
func (h *RegistryHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers plugin management HTTP routes on the given mux.
type RemoteRegistry ¶
type RemoteRegistry struct {
// contains filtered or unexported fields
}
RemoteRegistry discovers and downloads plugins from a remote HTTP registry.
func NewRemoteRegistry ¶
func NewRemoteRegistry(baseURL string, opts ...RemoteRegistryOption) *RemoteRegistry
NewRemoteRegistry creates a new remote registry client.
func (*RemoteRegistry) ClearCache ¶
func (r *RemoteRegistry) ClearCache()
ClearCache clears the in-memory manifest cache.
func (*RemoteRegistry) Download ¶
func (r *RemoteRegistry) Download(ctx context.Context, name, version string) (io.ReadCloser, error)
Download retrieves the plugin archive for a specific version.
func (*RemoteRegistry) GetManifest ¶
func (r *RemoteRegistry) GetManifest(ctx context.Context, name, version string) (*PluginManifest, error)
GetManifest retrieves the manifest for a specific plugin version from the remote registry.
func (*RemoteRegistry) ListVersions ¶
ListVersions retrieves available versions for a plugin from the remote registry.
func (*RemoteRegistry) Search ¶
func (r *RemoteRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)
Search queries the remote registry for plugins matching the given query string.
type RemoteRegistryOption ¶
type RemoteRegistryOption func(*RemoteRegistry)
RemoteRegistryOption configures a RemoteRegistry.
func WithCacheTTL ¶
func WithCacheTTL(ttl time.Duration) RemoteRegistryOption
WithCacheTTL sets how long cached manifests remain valid.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) RemoteRegistryOption
WithHTTPClient sets the HTTP client used by the remote registry.
type Semver ¶
Semver represents a parsed semantic version.
func ParseSemver ¶
ParseSemver parses a version string like "1.2.3" into a Semver.
type StepFactory ¶
StepFactory creates a pipeline step from config. The returned value should implement the PipelineStep interface (module.PipelineStep). We use any here to avoid a circular import on the module package.
type TriggerFactory ¶
type TriggerFactory func() any
TriggerFactory creates a trigger instance. The returned value should implement the Trigger interface (module.Trigger: Name, Start, Stop, Configure).
type UIPageDef ¶
type UIPageDef struct {
ID string `json:"id"`
Label string `json:"label"`
Icon string `json:"icon"`
Category string `json:"category"` // "global", "workflow", "plugin"
Order int `json:"order"`
RequiredRole string `json:"requiredRole,omitempty"` // minimum role: "viewer", "editor", "admin", "operator"
RequiredPermission string `json:"requiredPermission,omitempty"` // specific permission key, e.g. "plugins.manage"
APIEndpoint string `json:"apiEndpoint,omitempty"` // JSON data source for template pages
Template string `json:"template,omitempty"` // predefined template: "data-table", "chart-dashboard", "form", "detail-view"
}
UIPageDef describes a UI page contributed by a plugin.
type WiringHook ¶
type WiringHook struct {
Name string
Priority int // higher priority runs first
Hook func(app modular.Application, cfg *config.WorkflowConfig) error
}
WiringHook is called after module initialization to wire cross-module integrations.
type WorkflowHandlerFactory ¶
type WorkflowHandlerFactory func() any
WorkflowHandlerFactory creates a workflow handler instance. The returned value should implement WorkflowHandler (CanHandle, ConfigureWorkflow, ExecuteWorkflow).
type WorkflowPlugin ¶
type WorkflowPlugin interface {
NativePlugin
EmbeddedWorkflows() []EmbeddedWorkflow
}
WorkflowPlugin extends NativePlugin with the ability to contribute embedded workflows that can be invoked as sub-workflows from pipelines.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
ai
|
|
|
anthropic
Package anthropic provides an AIProvider implementation for the Anthropic Claude API.
|
Package anthropic provides an AIProvider implementation for the Anthropic Claude API. |
|
generic
Package generic provides an AIProvider implementation for any OpenAI-compatible API.
|
Package generic provides an AIProvider implementation for any OpenAI-compatible API. |
|
openai
Package openai provides an AIProvider implementation for the OpenAI API.
|
Package openai provides an AIProvider implementation for the OpenAI API. |