{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package plugin\n\nPackage plugin contains Workflow's plugin manifest, registry, loading, and installation primitives.\n\nHost-side code normally starts with PluginManifest values loaded from plugin.json files, then uses Manager, Loader, or Registry implementations to resolve plugin metadata and executables. Plugin authors usually consume the higher-level packages under plugin/external/sdk and plugin/sdk instead.\n\n## Functions\n\n```go\nfunc AutoFetchDeclaredPlugins(decls []AutoFetchDecl, pluginDir string, logger *slog.Logger)\n```\nAutoFetchDeclaredPlugins iterates the declared external plugins and, for each with AutoFetch enabled, calls AutoFetchPlugin. If wfctl is not on PATH, a warning is logged and the plugin is skipped rather than failing startup. Other errors are logged as warnings but do not abort the remaining plugins.\n\nCallers should invoke this before plugin discovery/loading so that newly fetched plugins are available in the current startup.\n\n```go\nfunc AutoFetchPlugin(pluginName, version, pluginDir string) error\n```\nAutoFetchPlugin downloads a plugin from the registry if it's not already installed. It shells out to wfctl for the actual download/install logic. version is an optional semver constraint (e.g., \"\u003e=0.1.0\" or \"0.2.0\").\n\n```go\nfunc CheckVersion(version, constraint string) (bool, error)\n```\nCheckVersion checks if a version string satisfies a constraint string.\n\n```go\nfunc RegisterNativePluginFactory(f NativePluginFactory)\n```\nRegisterNativePluginFactory adds a factory to the global built-in NativePlugin registry. Call this from init() in plugin packages that provide standalone NativePlugins.\n\n```go\nfunc SaveManifest(path string, manifest *PluginManifest) error\n```\nSaveManifest writes a manifest to a JSON file.\n\n```go\nfunc VerifyPluginIntegrity(pluginDir, pluginName string) error\n```\nVerifyPluginIntegrity checks the plugin binary's SHA-256 against the lockfile. Returns nil if no lockfile exists, no entry for this plugin, or no checksum pinned.\n\n## Types\n\n```go\ntype APIHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nAPIHandler serves HTTP endpoints for the plugin registry.\n\n```go\nfunc NewAPIHandler(registry *LocalRegistry, loader *dynamic.Loader) *APIHandler\n```\nNewAPIHandler creates a new plugin API handler.\n\n```go\nfunc (h *APIHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers the plugin API routes on the given mux.\n\n```go\ntype AutoFetchDecl struct {\n\tName      string\n\tVersion   string\n\tAutoFetch bool\n}\n```\nAutoFetchDecl is the minimum interface the engine passes per declared external plugin.\n\n```go\ntype BaseEnginePlugin struct {\n\tBaseNativePlugin\n\tManifest PluginManifest\n}\n```\nBaseEnginePlugin provides no-op defaults for all EnginePlugin methods. Embed this in concrete plugin implementations to only override what you need.\n\n```go\nfunc (b *BaseEnginePlugin) Capabilities() []capability.Contract\n```\nCapabilities returns an empty capability list.\n\n```go\nfunc (b *BaseEnginePlugin) ConfigTransformHooks() []ConfigTransformHook\n```\nConfigTransformHooks returns no config transform hooks.\n\n```go\nfunc (b *BaseEnginePlugin) DeployTargets() map[string]deploy.DeployTarget\n```\nDeployTargets returns no deploy targets.\n\n```go\nfunc (b *BaseEnginePlugin) EngineManifest() *PluginManifest\n```\nEngineManifest returns the plugin manifest.\n\n```go\nfunc (b *BaseEnginePlugin) ModuleFactories() map[string]ModuleFactory\n```\nModuleFactories returns no module factories.\n\n```go\nfunc (b *BaseEnginePlugin) ModuleSchemas() []*schema.ModuleSchema\n```\nModuleSchemas returns no module schemas.\n\n```go\nfunc (b *BaseEnginePlugin) SidecarProviders() map[string]deploy.SidecarProvider\n```\nSidecarProviders returns no sidecar providers.\n\n```go\nfunc (b *BaseEnginePlugin) StepFactories() map[string]StepFactory\n```\nStepFactories returns no step factories.\n\n```go\nfunc (b *BaseEnginePlugin) StepSchemas() []*schema.StepSchema\n```\nStepSchemas returns no step schemas.\n\n```go\nfunc (b *BaseEnginePlugin) TriggerFactories() map[string]TriggerFactory\n```\nTriggerFactories returns no trigger factories.\n\n```go\nfunc (b *BaseEnginePlugin) WiringHooks() []WiringHook\n```\nWiringHooks returns no wiring hooks.\n\n```go\nfunc (b *BaseEnginePlugin) WorkflowHandlers() map[string]WorkflowHandlerFactory\n```\nWorkflowHandlers returns no workflow handler factories.\n\n```go\ntype BaseNativePlugin struct {\n\tPluginName        string\n\tPluginVersion     string\n\tPluginDescription string\n}\n```\nBaseNativePlugin provides no-op defaults for all NativePlugin methods. Embed this in concrete implementations to only override what you need.\n\n```go\nfunc (b *BaseNativePlugin) Dependencies() []PluginDependency\n```\n\n```go\nfunc (b *BaseNativePlugin) Description() string\n```\n\n```go\nfunc (b *BaseNativePlugin) Name() string\n```\n\n```go\nfunc (b *BaseNativePlugin) OnDisable(_ PluginContext) error\n```\n\n```go\nfunc (b *BaseNativePlugin) OnEnable(_ PluginContext) error\n```\n\n```go\nfunc (b *BaseNativePlugin) RegisterRoutes(_ *http.ServeMux)\n```\n\n```go\nfunc (b *BaseNativePlugin) UIPages() []UIPageDef\n```\n\n```go\nfunc (b *BaseNativePlugin) Version() string\n```\n\n```go\ntype CapabilityDecl struct {\n\tName     string `json:\"name\" yaml:\"name\"`\n\tRole     string `json:\"role\" yaml:\"role\"` // \"provider\" or \"consumer\"\n\tPriority int    `json:\"priority,omitempty\" yaml:\"priority,omitempty\"`\n}\n```\nCapabilityDecl declares a capability relationship for a plugin in the manifest.\n\n```go\ntype CompositeRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nCompositeRegistry combines a local registry with a remote registry, searching both and allowing installation from the remote into local.\n\n```go\nfunc NewCompositeRegistry(local *LocalRegistry, remote *RemoteRegistry) *CompositeRegistry\n```\nNewCompositeRegistry creates a composite registry from a local and remote registry.\n\n```go\nfunc (c *CompositeRegistry) CheckDependencies(manifest *PluginManifest) error\n```\nCheckDependencies delegates to the local registry.\n\n```go\nfunc (c *CompositeRegistry) Get(name string) (*PluginEntry, bool)\n```\nGet delegates to the local registry.\n\n```go\nfunc (c *CompositeRegistry) Install(ctx context.Context, name, version string) error\n```\nInstall downloads a plugin from the remote registry and registers it locally.\n\n```go\nfunc (c *CompositeRegistry) List() []*PluginEntry\n```\nList delegates to the local registry.\n\n```go\nfunc (c *CompositeRegistry) Local() *LocalRegistry\n```\nLocal returns the underlying local registry.\n\n```go\nfunc (c *CompositeRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error\n```\nRegister delegates to the local registry.\n\n```go\nfunc (c *CompositeRegistry) Remote() *RemoteRegistry\n```\nRemote returns the underlying remote registry.\n\n```go\nfunc (c *CompositeRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)\n```\nSearch checks local first, then remote, merging results with no duplicates.\n\n```go\nfunc (c *CompositeRegistry) Unregister(name string) error\n```\nUnregister delegates to the local registry.\n\n```go\ntype ConfigTransformHook struct {\n\tName     string\n\tPriority int // higher priority runs first\n\tHook     func(cfg *config.WorkflowConfig) error\n}\n```\nConfigTransformHook runs BEFORE module registration in BuildFromConfig, allowing plugins to inject modules, workflows, and triggers into the config.\n\n```go\ntype Constraint struct {\n\tOp      string\n\tVersion Semver\n}\n```\nConstraint represents a semver constraint that can check version compatibility.\n\n```go\nfunc ParseConstraint(s string) (*Constraint, error)\n```\nParseConstraint parses a constraint string like \"\u003e=1.0.0\", \"^2.1.0\", \"~1.2.0\".\n\n```go\nfunc (c *Constraint) Check(v Semver) bool\n```\nCheck returns true if the given version satisfies the constraint.\n\n```go\ntype CosignVerifier struct {\n\tOIDCIssuer            string\n\tAllowedIdentityRegexp string\n}\n```\nCosignVerifier verifies plugin binaries using cosign keyless signatures. It requires the cosign CLI to be installed; if not found, verification is skipped with a warning to support environments without cosign installed.\n\n```go\nfunc NewCosignVerifier(oidcIssuer, identityRegexp string) *CosignVerifier\n```\nNewCosignVerifier creates a CosignVerifier for the given OIDC issuer and identity regexp (e.g. \"[https://github.com/GoCodeAlone/.\\*](https://github.com/GoCodeAlone/.*)\").\n\n```go\nfunc (v *CosignVerifier) Verify(binaryPath, sigPath, certPath string) error\n```\nVerify runs \\`cosign verify-blob\\` to validate the signature of a plugin binary. If cosign is not installed, a warning is logged and nil is returned so that deployments without cosign are not broken.\n\n```go\ntype Dependency struct {\n\tName       string `json:\"name\" yaml:\"name\"`\n\tConstraint string `json:\"constraint\" yaml:\"constraint\"` // semver constraint, e.g. \"\u003e=1.0.0\", \"^2.1\"\n}\n```\nDependency declares a versioned dependency on another plugin.\n\n```go\ntype EmbeddedWorkflow struct {\n\tName         string                           `json:\"name\"`\n\tDescription  string                           `json:\"description\"`\n\tConfig       *config.WorkflowConfig           `json:\"-\"`\n\tConfigYAML   string                           `json:\"configYaml,omitempty\"`\n\tInputSchema  map[string]schema.ConfigFieldDef `json:\"inputSchema,omitempty\"`\n\tOutputSchema map[string]schema.ConfigFieldDef `json:\"outputSchema,omitempty\"`\n}\n```\nEmbeddedWorkflow describes a workflow contributed by a plugin.\n\n```go\ntype EnginePlugin interface {\n\tNativePlugin\n\n\t// EngineManifest returns the extended plugin manifest with capability declarations.\n\tEngineManifest() *PluginManifest\n\n\t// Capabilities returns the capability contracts this plugin defines or satisfies.\n\tCapabilities() []capability.Contract\n\n\t// ModuleFactories returns module type factories.\n\t// Key is the module type string (e.g., \"http.server\").\n\t// Value is func(name string, cfg map[string]any) modular.Module\n\tModuleFactories() map[string]ModuleFactory\n\n\t// StepFactories returns pipeline step type factories.\n\t// Key is the step type string (e.g., \"step.validate\").\n\tStepFactories() map[string]StepFactory\n\n\t// TriggerFactories returns trigger type constructors.\n\t// Key is the trigger type string (e.g., \"http\").\n\tTriggerFactories() map[string]TriggerFactory\n\n\t// WorkflowHandlers returns workflow handler factories.\n\t// Key is the workflow type string (e.g., \"http\", \"messaging\").\n\tWorkflowHandlers() map[string]WorkflowHandlerFactory\n\n\t// ModuleSchemas returns UI schema definitions for this plugin's module types.\n\tModuleSchemas() []*schema.ModuleSchema\n\n\t// StepSchemas returns schema definitions for this plugin's pipeline step types.\n\tStepSchemas() []*schema.StepSchema\n\n\t// WiringHooks returns post-init wiring functions.\n\tWiringHooks() []WiringHook\n\n\t// ConfigTransformHooks returns hooks that run before module registration in BuildFromConfig.\n\tConfigTransformHooks() []ConfigTransformHook\n\n\t// DeployTargets returns deploy target implementations (e.g., \"kubernetes\", \"ecs\").\n\tDeployTargets() map[string]deploy.DeployTarget\n\n\t// SidecarProviders returns sidecar provider implementations (e.g., \"sidecar.tailscale\").\n\tSidecarProviders() map[string]deploy.SidecarProvider\n}\n```\nEnginePlugin extends NativePlugin with engine-level contributions: module type factories, step type factories, trigger factories, workflow handlers, capability contracts, and wiring hooks.\n\n```go\ntype EnginePluginManager struct {\n\t// contains filtered or unexported fields\n}\n```\nEnginePluginManager wraps the PluginLoader with lifecycle management, allowing plugins to be registered, enabled, and disabled independently.\n\n```go\nfunc NewEnginePluginManager(capReg *capability.Registry, schemaReg *schema.ModuleSchemaRegistry) *EnginePluginManager\n```\nNewEnginePluginManager creates a new manager backed by the given capability and schema registries.\n\n```go\nfunc (m *EnginePluginManager) Disable(name string) error\n```\nDisable 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.\n\n```go\nfunc (m *EnginePluginManager) Enable(name string) error\n```\nEnable activates a registered plugin, loading it into the PluginLoader. Returns an error if the plugin is not registered or is already enabled.\n\n```go\nfunc (m *EnginePluginManager) Get(name string) (EnginePlugin, bool)\n```\nGet returns the plugin with the given name and a boolean indicating whether it exists.\n\n```go\nfunc (m *EnginePluginManager) IsEnabled(name string) bool\n```\nIsEnabled returns true if the named plugin is currently enabled.\n\n```go\nfunc (m *EnginePluginManager) List() []EnginePlugin\n```\nList returns all registered plugins (enabled and disabled).\n\n```go\nfunc (m *EnginePluginManager) Loader() *PluginLoader\n```\nLoader returns the underlying PluginLoader for accessing aggregated factories and hooks.\n\n```go\nfunc (m *EnginePluginManager) Register(p EnginePlugin) error\n```\nRegister adds a plugin to the manager without enabling it. Returns an error if a plugin with the same name is already registered.\n\n```go\nfunc (m *EnginePluginManager) ResolveWorkflowDependencies(cfg *config.WorkflowConfig) error\n```\nResolveWorkflowDependencies 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.\n\n```go\ntype IaCProviderCapability struct {\n\tName               string   `json:\"name,omitempty\" yaml:\"name,omitempty\"`\n\tResourceTypes      []string `json:\"resourceTypes,omitempty\" yaml:\"resourceTypes,omitempty\"`\n\tComputePlanVersion string   `json:\"computePlanVersion,omitempty\" yaml:\"computePlanVersion,omitempty\"`\n}\n```\nIaCProviderCapability declares IaC provider metadata in a plugin manifest.\n\n```go\ntype IaCStateBackendProvider interface {\n\tIaCStateBackendClients() (map[string]proto.IaCStateBackendClient, error)\n}\n```\nIaCStateBackendProvider is the optional interface an external-plugin adapter implements when its plugin serves one or more iac.state backends. The engine type-asserts loaded plugins against it (same pattern as stepRegistrySetter) and populates module's iac.state backend registry.\n\n```go\ntype KubernetesBackendProvider interface {\n\tKubernetesBackendClients() (map[string]proto.ResourceDriverClient, error)\n}\n```\nKubernetesBackendProvider is the optional interface an external-plugin adapter implements when its plugin serves one or more platform.kubernetes cluster-type backends (e.g. \"gke\"). The engine type-asserts loaded plugins against it (same pattern as IaCStateBackendProvider) and populates module's kubernetes backend registry.\n\nPer ADR 0037 a kubernetes backend is served over the existing ResourceDriver contract — no new proto surface — so the returned clients are proto.ResourceDriverClient values keyed by cluster type name.\n\n```go\ntype LicenseValidator interface {\n\t// ValidatePlugin returns nil if the named plugin is licensed for use.\n\tValidatePlugin(pluginName string) error\n}\n```\nLicenseValidator is an optional service that approves or denies premium plugin usage. If registered under the name \"license-validator\", the loader will call it during tier validation for premium plugins.\n\n```go\ntype LocalRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nLocalRegistry implements PluginRegistry by scanning local directories.\n\n```go\nfunc NewLocalRegistry() *LocalRegistry\n```\nNewLocalRegistry creates a new empty local registry.\n\n```go\nfunc (r *LocalRegistry) CheckDependencies(manifest *PluginManifest) error\n```\nCheckDependencies verifies that all dependencies declared in the manifest are satisfied by currently registered plugins.\n\n```go\nfunc (r *LocalRegistry) Get(name string) (*PluginEntry, bool)\n```\nGet retrieves a plugin entry by name.\n\n```go\nfunc (r *LocalRegistry) List() []*PluginEntry\n```\nList returns all registered plugin entries.\n\n```go\nfunc (r *LocalRegistry) Register(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error\n```\nRegister adds a plugin to the registry after validating its manifest and checking version compatibility of declared dependencies.\n\n```go\nfunc (r *LocalRegistry) ScanDirectory(dir string, loader *dynamic.Loader) ([]*PluginEntry, error)\n```\nScanDirectory scans a directory for plugin subdirectories. Each subdirectory should contain a plugin.json manifest and a .go source file.\n\n```go\nfunc (r *LocalRegistry) Unregister(name string) error\n```\nUnregister removes a plugin from the registry.\n\n```go\ntype MissingCapabilitiesError struct {\n\tMissing []string\n}\n```\nMissingCapabilitiesError is returned when a workflow config requires capabilities that no loaded plugin provides.\n\n```go\nfunc (e *MissingCapabilitiesError) Error() string\n```\n\n```go\ntype ModernizeRulesProvider interface {\n\tModernizeRules() []modernize.Rule\n}\n```\nModernizeRulesProvider is optionally implemented by EnginePlugins that wish to supply custom modernize rules for the wfctl modernize command. The rules returned by this interface are intended to be collected by the engine or tooling and merged with the core built-in rules when modernizing workflow configs that use this plugin's module/step types.\n\nExternal (process-isolated) plugins declare their rules in plugin.json under the \"modernizeRules\" key and have them loaded automatically via modernize.LoadRulesFromDir. In-process Go plugins can implement this interface to expose function-based rules that perform arbitrary YAML transforms. At present this interface serves as an API/extension point; integrating it into a particular engine or CLI is up to that consumer.\n\n```go\ntype ModuleFactory func(name string, config map[string]any) modular.Module\n```\nModuleFactory creates a modular.Module from a name and config map.\n\n```go\ntype NativeHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nNativeHandler serves HTTP endpoints for native plugin discovery and route dispatch. It delegates all behavior to the PluginManager.\n\n```go\nfunc NewNativeHandler(manager *PluginManager) *NativeHandler\n```\nNewNativeHandler creates a new handler backed by a PluginManager.\n\n```go\nfunc (h *NativeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP implements http.Handler by delegating to the PluginManager.\n\n```go\ntype NativePlugin interface {\n\tName() string\n\tVersion() string\n\tDescription() string\n\tDependencies() []PluginDependency\n\tUIPages() []UIPageDef\n\tRegisterRoutes(mux *http.ServeMux)\n\tOnEnable(ctx PluginContext) error\n\tOnDisable(ctx PluginContext) error\n}\n```\nNativePlugin is a compiled-in plugin that provides HTTP handlers, UI page metadata, and lifecycle hooks with dependency declarations.\n\n```go\nfunc BuiltinNativePlugins(db *sql.DB, deps map[string]any) []NativePlugin\n```\nBuiltinNativePlugins creates all registered built-in NativePlugins. The db parameter is the shared database connection. Additional dependencies are passed as key-value pairs in the deps map. Plugins that return nil are skipped.\n\n```go\ntype NativePluginFactory func(db *sql.DB, deps map[string]any) NativePlugin\n```\nNativePluginFactory creates a NativePlugin given a database connection and a set of optional dependencies keyed by name. The factory may return nil if its prerequisites are not met (e.g., no database available).\n\n```go\ntype NativePluginProvider interface {\n\tNativePlugins(ctx PluginContext) []NativePlugin\n}\n```\nNativePluginProvider is optionally implemented by EnginePlugins that also contribute NativePlugins (e.g., for Marketplace visibility, UI pages, or HTTP route handlers). The PluginContext provides shared resources (DB, logger).\n\n```go\ntype PipelineTriggerConfigProvider interface {\n\tPipelineTriggerConfigWrappers() map[string]TriggerConfigWrapperFunc\n}\n```\nPipelineTriggerConfigProvider is optionally implemented by EnginePlugins that register triggers. It provides config wrapper functions that convert flat pipeline trigger config (e.g., {path, method}) into the trigger's native configuration format (e.g., {routes: \\[{...}]}).\n\n```go\ntype PluginConfigTarget struct {\n\tProvider    string   `json:\"provider\" yaml:\"provider\"`\n\tScopes      []string `json:\"scopes,omitempty\" yaml:\"scopes,omitempty\"`\n\tDescription string   `json:\"description,omitempty\" yaml:\"description,omitempty\"`\n}\n```\nPluginConfigTarget is a provider-owned variable/config store supported by a plugin for RequiredConfig values.\n\n```go\ntype PluginContext struct {\n\tApp     interface{} // modular.Application — use interface{} to avoid import cycle\n\tDB      *sql.DB\n\tLogger  *slog.Logger\n\tDataDir string\n}\n```\nPluginContext provides shared resources to plugins during lifecycle events.\n\n```go\ntype PluginDependency struct {\n\tName       string `json:\"name\"`       // required plugin name\n\tMinVersion string `json:\"minVersion\"` // semver constraint, empty = any version\n}\n```\nPluginDependency declares a dependency on another plugin.\n\n```go\ntype PluginEntry struct {\n\tManifest  *PluginManifest           `json:\"manifest\"`\n\tComponent *dynamic.DynamicComponent `json:\"-\"`\n\tSourceDir string                    `json:\"source_dir,omitempty\"`\n}\n```\nPluginEntry holds the manifest and component for a registered plugin.\n\n```go\ntype PluginInfo struct {\n\tName         string             `json:\"name\"`\n\tVersion      string             `json:\"version\"`\n\tDescription  string             `json:\"description\"`\n\tEnabled      bool               `json:\"enabled\"`\n\tUIPages      []UIPageDef        `json:\"uiPages\"`\n\tDependencies []PluginDependency `json:\"dependencies\"`\n\tEnabledAt    string             `json:\"enabledAt,omitempty\"`\n\tDisabledAt   string             `json:\"disabledAt,omitempty\"`\n}\n```\nPluginInfo is the JSON representation of a plugin for API responses. JSON field names use camelCase to match the TypeScript UI conventions.\n\n```go\ntype PluginInstaller struct {\n\t// contains filtered or unexported fields\n}\n```\nPluginInstaller handles installing plugins from remote or local sources.\n\n```go\nfunc NewPluginInstaller(remoteReg *RemoteRegistry, localReg *LocalRegistry, loader *dynamic.Loader, installDir string) *PluginInstaller\n```\nNewPluginInstaller creates a new plugin installer.\n\n```go\nfunc (i *PluginInstaller) Install(ctx context.Context, name, version string) error\n```\nInstall downloads and installs a plugin from the remote registry.\n\n```go\nfunc (i *PluginInstaller) InstallDir() string\n```\nInstallDir returns the configured plugin installation directory.\n\n```go\nfunc (i *PluginInstaller) InstallFromBundle(bundlePath string) error\n```\nInstallFromBundle installs a plugin from a local bundle directory. The bundle directory must contain a plugin.json manifest.\n\n```go\nfunc (i *PluginInstaller) IsInstalled(name string) bool\n```\nIsInstalled checks if a plugin is installed locally.\n\n```go\nfunc (i *PluginInstaller) ScanInstalled() ([]*PluginEntry, error)\n```\nScanInstalled loads all previously installed plugins from the install directory.\n\n```go\nfunc (i *PluginInstaller) Uninstall(name string) error\n```\nUninstall removes an installed plugin.\n\n```go\ntype PluginLoader struct {\n\t// contains filtered or unexported fields\n}\n```\nPluginLoader loads EnginePlugins and populates registries.\n\n```go\nfunc NewPluginLoader(capReg *capability.Registry, schemaReg *schema.ModuleSchemaRegistry, stepSchemaReg ...*schema.StepSchemaRegistry) *PluginLoader\n```\nNewPluginLoader creates a new PluginLoader backed by the given capability and schema registries.\n\n```go\nfunc (l *PluginLoader) CapabilityRegistry() *capability.Registry\n```\nCapabilityRegistry returns the loader's capability registry.\n\n```go\nfunc (l *PluginLoader) ConfigTransformHooks() []ConfigTransformHook\n```\nConfigTransformHooks returns all registered config transform hooks sorted by priority (highest first).\n\n```go\nfunc (l *PluginLoader) DeployTargets() map[string]deploy.DeployTarget\n```\nDeployTargets returns a defensive copy of all registered deploy targets.\n\n```go\nfunc (l *PluginLoader) LoadBinaryPlugin(p EnginePlugin, binaryPath, sigPath, certPath string) error\n```\nLoadBinaryPlugin verifies a plugin binary with cosign (for premium plugins) and then loads the plugin into the registry. binaryPath, sigPath, and certPath are paths to the plugin binary, cosign signature file, and certificate file respectively. If cosignVerifier is nil, verification is skipped.\n\n```go\nfunc (l *PluginLoader) LoadBinaryPluginWithOverride(p EnginePlugin, binaryPath, sigPath, certPath string) error\n```\nLoadBinaryPluginWithOverride is the override-capable counterpart to LoadBinaryPlugin. It verifies the plugin binary with cosign (for premium plugins) and then loads the plugin, allowing it to override existing module, step, trigger, handler, deploy target, and sidecar provider registrations. When a duplicate type is encountered, the new factory replaces the previous one and a warning is logged instead of returning an error.\n\n```go\nfunc (l *PluginLoader) LoadPlugin(p EnginePlugin) error\n```\nLoadPlugin 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.\n\n```go\nfunc (l *PluginLoader) LoadPluginWithOverride(p EnginePlugin) error\n```\nLoadPluginWithOverride is like LoadPlugin but allows the plugin to override existing module, step, trigger, handler, deploy target, and sidecar provider registrations. When a duplicate type is encountered, the new factory replaces the previous one and a warning is logged instead of returning an error. This is intended for external plugins that intentionally replace built-in defaults (e.g., replacing a mock authz step with a production implementation).\n\n```go\nfunc (l *PluginLoader) LoadPlugins(plugins []EnginePlugin) error\n```\nLoadPlugins performs a topological sort of plugins by their manifest dependencies, then loads each in order. Returns an error on circular dependencies or load failures.\n\n```go\nfunc (l *PluginLoader) LoadedPlugins() []EnginePlugin\n```\nLoadedPlugins returns all successfully loaded plugins in load order.\n\n```go\nfunc (l *PluginLoader) ModuleFactories() map[string]ModuleFactory\n```\nModuleFactories returns a defensive copy of all registered module factories.\n\n```go\nfunc (l *PluginLoader) OverridableTypes() map[string]bool\n```\nOverridableTypes returns a read-only copy of all type names that have been declared overridable by loaded plugins.\n\n```go\nfunc (l *PluginLoader) PreInitWiringHooks() []WiringHook\n```\nPreInitWiringHooks returns all registered pre-init wiring hooks sorted by priority (highest first).\n\n```go\nfunc (l *PluginLoader) SetCosignVerifier(v *CosignVerifier)\n```\nSetCosignVerifier registers a cosign verifier for binary signature verification of premium plugins. When set, LoadBinaryPlugin will verify the plugin binary before loading it.\n\n```go\nfunc (l *PluginLoader) SetEngineVersion(v string)\n```\nSetEngineVersion sets the running engine version used for minEngineVersion compatibility checks when loading plugins.\n\n```go\nfunc (l *PluginLoader) SetLicenseValidator(v LicenseValidator)\n```\nSetLicenseValidator registers a license validator used for premium tier plugins.\n\n```go\nfunc (l *PluginLoader) SidecarProviders() map[string]deploy.SidecarProvider\n```\nSidecarProviders returns a defensive copy of all registered sidecar providers.\n\n```go\nfunc (l *PluginLoader) StepFactories() map[string]StepFactory\n```\nStepFactories returns a defensive copy of all registered step factories.\n\n```go\nfunc (l *PluginLoader) StepSchemaRegistry() *schema.StepSchemaRegistry\n```\nStepSchemaRegistry returns the loader's step schema registry.\n\n```go\nfunc (l *PluginLoader) TriggerFactories() map[string]TriggerFactory\n```\nTriggerFactories returns a defensive copy of all registered trigger factories.\n\n```go\nfunc (l *PluginLoader) ValidateTier(manifest *PluginManifest) error\n```\nlicense validator configuration:\n\n  - Core and Community plugins are always allowed.\n  - Premium plugins are validated against the LicenseValidator if one is set. If no validator is configured, a warning is logged and the plugin is allowed (graceful degradation for self-hosted deployments without a license).\n\n```go\nfunc (l *PluginLoader) WiringHooks() []WiringHook\n```\nWiringHooks returns all registered wiring hooks sorted by priority (highest first).\n\n```go\nfunc (l *PluginLoader) WorkflowHandlerFactories() map[string]WorkflowHandlerFactory\n```\nWorkflowHandlerFactories returns a defensive copy of all registered workflow handler factories.\n\n```go\ntype PluginManager struct {\n\t// contains filtered or unexported fields\n}\n```\nPluginManager handles plugin registration, dependency resolution, lifecycle management, enable/disable state persistence, and HTTP route dispatch.\n\n```go\nfunc NewPluginManager(db *sql.DB, logger *slog.Logger) *PluginManager\n```\nNewPluginManager creates a new PluginManager with SQLite-backed state persistence. It initializes the plugin\\_state table if it does not exist.\n\n```go\nfunc (pm *PluginManager) AllPlugins() []PluginInfo\n```\nAllPlugins returns info about all registered plugins sorted by name.\n\n```go\nfunc (pm *PluginManager) Disable(name string) error\n```\nDisable disables a plugin and all plugins that depend on it (reverse dependency order). Returns an error if the plugin is not registered.\n\n```go\nfunc (pm *PluginManager) Enable(name string) error\n```\nEnable 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.\n\n```go\nfunc (pm *PluginManager) EnabledPlugins() []NativePlugin\n```\nEnabledPlugins returns all currently enabled plugins sorted by name.\n\n```go\nfunc (pm *PluginManager) IsEnabled(name string) bool\n```\nIsEnabled returns whether a plugin is currently enabled.\n\n```go\nfunc (pm *PluginManager) Register(p NativePlugin) error\n```\nRegister 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.\n\n```go\nfunc (pm *PluginManager) RestoreState() error\n```\nRestoreState re-enables all plugins that were previously enabled (from the plugin\\_state table). This is called after an engine restart or reload.\n\n```go\nfunc (pm *PluginManager) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP 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.\n\n```go\nfunc (pm *PluginManager) SetContext(ctx PluginContext)\n```\nSetContext sets the shared PluginContext used for OnEnable/OnDisable calls.\n\n```go\ntype PluginManifest struct {\n\tName         string                 `json:\"name\" yaml:\"name\"`\n\tVersion      string                 `json:\"version\" yaml:\"version\"`\n\tAuthor       string                 `json:\"author\" yaml:\"author\"`\n\tDescription  string                 `json:\"description\" yaml:\"description\"`\n\tLicense      string                 `json:\"license,omitempty\" yaml:\"license,omitempty\"`\n\tDependencies []Dependency           `json:\"dependencies,omitempty\" yaml:\"dependencies,omitempty\"`\n\tContract     *dynamic.FieldContract `json:\"contract,omitempty\" yaml:\"contract,omitempty\"`\n\tTags         []string               `json:\"tags,omitempty\" yaml:\"tags,omitempty\"`\n\tRepository   string                 `json:\"repository,omitempty\" yaml:\"repository,omitempty\"`\n\tTier         PluginTier             `json:\"tier,omitempty\" yaml:\"tier,omitempty\"`\n\n\t// Engine plugin declarations\n\tCapabilities  []CapabilityDecl `json:\"capabilities,omitempty\" yaml:\"capabilities,omitempty\"`\n\tModuleTypes   []string         `json:\"moduleTypes,omitempty\" yaml:\"moduleTypes,omitempty\"`\n\tStepTypes     []string         `json:\"stepTypes,omitempty\" yaml:\"stepTypes,omitempty\"`\n\tTriggerTypes  []string         `json:\"triggerTypes,omitempty\" yaml:\"triggerTypes,omitempty\"`\n\tWorkflowTypes []string         `json:\"workflowTypes,omitempty\" yaml:\"workflowTypes,omitempty\"`\n\tWiringHooks   []string         `json:\"wiringHooks,omitempty\" yaml:\"wiringHooks,omitempty\"`\n\n\t// Grammar is a NEW sibling top-level field (⊥ nesting under moduleTypes,\n\t// which is []string) declaring Assembly Grammar keyed by module-type name\n\t// (ADR 0049 / design D1). Local/sibling plugin.json parses permissively;\n\t// registry-manifest grammar is deferred to M2 (strict registry-schema.json).\n\tGrammar map[string]schema.GrammarDecl `json:\"grammar,omitempty\" yaml:\"grammar,omitempty\"`\n\n\t// IaCStateBackends lists the iac.state backend names this plugin serves\n\t// (e.g. \"azure_blob\"). Authored in plugin.json either as a top-level\n\t// \"iacStateBackends\" key or nested under the legacy capabilities object\n\t// as capabilities.iacStateBackends (UnmarshalJSON's object branch promotes\n\t// the nested form here, same as ModuleTypes/StepTypes/etc.). The engine\n\t// cross-checks these against the plugin's ListBackendNames RPC. Amendment\n\t// A2 (decisions/0035).\n\tIaCStateBackends []string `json:\"iacStateBackends,omitempty\" yaml:\"iacStateBackends,omitempty\"`\n\n\t// IaCServices lists the typed IaC service names this plugin serves\n\t// (fully-qualified gRPC service names, e.g.\n\t// \"workflow.plugin.external.iac.IaCProviderRequired\"). Authored in\n\t// plugin.json either as a top-level \"iacServices\" key OR nested under\n\t// \"capabilities.iacServices\" (UnmarshalJSON's object branch promotes\n\t// the nested form, same as IaCStateBackends). The engine cross-checks\n\t// these against the plugin's runtime ContractRegistry via wfctl plugin\n\t// verify-capabilities (workflow#767).\n\t//\n\t// Orthogonal to IaCStateBackends (which lists backend NAMES, not gRPC\n\t// service names). A plugin that registers the IaCStateBackend service\n\t// AND lists its backend names will appear in BOTH manifest fields.\n\tIaCServices []string `json:\"iacServices,omitempty\" yaml:\"iacServices,omitempty\"`\n\n\t// IaCProvider declares provider-specific IaC metadata from plugin.json.\n\t// Older manifests may author this under capabilities.iacProvider; the\n\t// custom unmarshaller promotes that legacy shape here so callers can rely\n\t// on one field.\n\tIaCProvider IaCProviderCapability `json:\"iacProvider,omitempty\" yaml:\"iacProvider,omitempty\"`\n\n\t// StepSchemas provides schema definitions for step types registered by this plugin.\n\t// Used by MCP/LSP for hover docs, completions, and output documentation.\n\tStepSchemas []*schema.StepSchema `json:\"stepSchemas,omitempty\" yaml:\"stepSchemas,omitempty\"`\n\n\t// ModernizeRules declares migration rules for the wfctl modernize command.\n\t// Each rule describes a common migration pattern (type renames, config key\n\t// renames) that users of this plugin may need to apply when upgrading.\n\t// These rules are loaded automatically when --plugin-dir is passed to\n\t// wfctl modernize or wfctl mcp.\n\tModernizeRules []modernize.ManifestRule `json:\"modernizeRules,omitempty\" yaml:\"modernizeRules,omitempty\"`\n\n\t// OverridableTypes lists type names (modules, steps, triggers, handlers) that may be\n\t// overridden by later-loaded plugins without requiring LoadPluginWithOverride.\n\t// Typically used for placeholder/mock implementations.\n\tOverridableTypes []string `json:\"overridableTypes,omitempty\" yaml:\"overridableTypes,omitempty\"`\n\n\t// Config mutability and sample plugin support\n\tConfigMutable  bool   `json:\"configMutable,omitempty\" yaml:\"configMutable,omitempty\"`\n\tSampleCategory string `json:\"sampleCategory,omitempty\" yaml:\"sampleCategory,omitempty\"`\n\n\t// MinEngineVersion declares the minimum engine version required to run this plugin.\n\t// A semver string without the \"v\" prefix, e.g. \"0.3.30\".\n\tMinEngineVersion string `json:\"minEngineVersion,omitempty\" yaml:\"minEngineVersion,omitempty\"`\n\n\t// RequiredConfig declares non-secret provider/application configuration\n\t// values needed by the plugin. Sensitive values belong in required_secrets.\n\tRequiredConfig []PluginRequiredConfig `json:\"required_config,omitempty\" yaml:\"required_config,omitempty\"`\n\t// ConfigTargets declares where RequiredConfig values may be stored, such as\n\t// GitHub Actions repository, environment, or organization variables.\n\tConfigTargets []PluginConfigTarget `json:\"config_targets,omitempty\" yaml:\"config_targets,omitempty\"`\n}\n```\nPluginManifest describes a plugin's metadata, dependencies, and contract.\n\n```go\nfunc LoadManifest(path string) (*PluginManifest, error)\n```\nLoadManifest reads a manifest from a JSON file.\n\n```go\nfunc (m *PluginManifest) UnmarshalJSON(data []byte) error\n```\nUnmarshalJSON implements custom JSON unmarshalling for PluginManifest that handles both the canonical capabilities array format and the legacy object format used by registry manifests and older plugin.json files.\n\nLegacy format: \"capabilities\": {\"configProvider\": bool, \"moduleTypes\": \\[...], ...} New format:    \"capabilities\": \\[{\"name\": \"...\", \"role\": \"...\"}]\n\nWhen the legacy object format is detected, its type lists are merged into the top-level ModuleTypes, StepTypes, and TriggerTypes fields so callers always find types in a consistent location. Any other JSON type (string, number, bool) is rejected with a descriptive error.\n\n```go\nfunc (m *PluginManifest) Validate() error\n```\nValidate checks that a manifest has all required fields and valid semver.\n\n```go\ntype PluginRegistry interface {\n\tRegister(manifest *PluginManifest, component *dynamic.DynamicComponent, sourceDir string) error\n\tUnregister(name string) error\n\tGet(name string) (*PluginEntry, bool)\n\tList() []*PluginEntry\n\tCheckDependencies(manifest *PluginManifest) error\n}\n```\nPluginRegistry manages plugin registration and lookup.\n\n```go\ntype PluginRequiredConfig struct {\n\tName        string `json:\"name\" yaml:\"name\"`\n\tKey         string `json:\"key,omitempty\" yaml:\"key,omitempty\"`\n\tSensitive   bool   `json:\"sensitive,omitempty\" yaml:\"sensitive,omitempty\"`\n\tDescription string `json:\"description,omitempty\" yaml:\"description,omitempty\"`\n\tPrompt      string `json:\"prompt,omitempty\" yaml:\"prompt,omitempty\"`\n}\n```\nPluginRequiredConfig is a non-secret setup value required by a plugin.\n\n```go\ntype PluginTier string\n```\nPluginTier indicates the support and licensing tier for a plugin.\n\n```go\nconst (\n\t// TierCore identifies plugins that are built-in and always available.\n\tTierCore PluginTier = \"core\"\n\t// TierCommunity identifies open-source community-contributed plugins.\n\tTierCommunity PluginTier = \"community\"\n\t// TierPremium identifies plugins that require a valid license to use.\n\tTierPremium PluginTier = \"premium\"\n)\n```\n\n```go\ntype PluginWorkflowRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nPluginWorkflowRegistry stores embedded workflows contributed by plugins. Workflows are keyed by qualified name: \"plugin-name:workflow-name\".\n\n```go\nfunc NewPluginWorkflowRegistry() *PluginWorkflowRegistry\n```\nNewPluginWorkflowRegistry creates an empty PluginWorkflowRegistry.\n\n```go\nfunc (r *PluginWorkflowRegistry) Get(qualifiedName string) (*EmbeddedWorkflow, bool)\n```\nGet retrieves a workflow by its qualified name (\"plugin:workflow\").\n\n```go\nfunc (r *PluginWorkflowRegistry) List() []string\n```\nList returns all registered qualified workflow names, sorted.\n\n```go\nfunc (r *PluginWorkflowRegistry) Register(pluginName string, wf EmbeddedWorkflow) error\n```\nRegister adds an embedded workflow under the given plugin name.\n\n```go\nfunc (r *PluginWorkflowRegistry) Unregister(pluginName string)\n```\nUnregister removes all workflows belonging to the given plugin.\n\n```go\ntype PreInitWiringHookProvider interface {\n\tPreInitWiringHooks() []WiringHook\n}\n```\nPreInitWiringHookProvider is optionally implemented by plugins that need to register services after modules are registered but before app.Init runs.\n\n```go\ntype RegistryHandler struct {\n\t// contains filtered or unexported fields\n}\n```\nRegistryHandler provides HTTP API handlers for plugin management.\n\n```go\nfunc NewRegistryHandler(registry *CompositeRegistry) *RegistryHandler\n```\nNewRegistryHandler creates a new registry handler backed by the given composite registry.\n\n```go\nfunc (h *RegistryHandler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers plugin management HTTP routes on the given mux.\n\n```go\ntype RemoteRegistry struct {\n\t// contains filtered or unexported fields\n}\n```\nRemoteRegistry discovers and downloads plugins from a remote HTTP registry.\n\n```go\nfunc NewRemoteRegistry(baseURL string, opts ...RemoteRegistryOption) *RemoteRegistry\n```\nNewRemoteRegistry creates a new remote registry client.\n\n```go\nfunc (r *RemoteRegistry) ClearCache()\n```\nClearCache clears the in-memory manifest cache.\n\n```go\nfunc (r *RemoteRegistry) Download(ctx context.Context, name, version string) (io.ReadCloser, error)\n```\nDownload retrieves the plugin archive for a specific version.\n\n```go\nfunc (r *RemoteRegistry) GetManifest(ctx context.Context, name, version string) (*PluginManifest, error)\n```\nGetManifest retrieves the manifest for a specific plugin version from the remote registry.\n\n```go\nfunc (r *RemoteRegistry) ListVersions(ctx context.Context, name string) ([]string, error)\n```\nListVersions retrieves available versions for a plugin from the remote registry.\n\n```go\nfunc (r *RemoteRegistry) Search(ctx context.Context, query string) ([]*PluginManifest, error)\n```\nSearch queries the remote registry for plugins matching the given query string.\n\n```go\ntype RemoteRegistryOption func(*RemoteRegistry)\n```\nRemoteRegistryOption configures a RemoteRegistry.\n\n```go\nfunc WithCacheTTL(ttl time.Duration) RemoteRegistryOption\n```\nWithCacheTTL sets how long cached manifests remain valid.\n\n```go\nfunc WithHTTPClient(client *http.Client) RemoteRegistryOption\n```\nWithHTTPClient sets the HTTP client used by the remote registry.\n\n```go\ntype Semver struct {\n\tMajor int\n\tMinor int\n\tPatch int\n}\n```\nSemver represents a parsed semantic version.\n\n```go\nfunc ParseSemver(v string) (Semver, error)\n```\nParseSemver parses a version string like \"1.2.3\" into a Semver.\n\n```go\nfunc (s Semver) Compare(other Semver) int\n```\nCompare returns -1, 0, or 1.\n\n```go\nfunc (s Semver) String() string\n```\n\n```go\ntype StepFactory func(name string, config map[string]any, app modular.Application) (any, error)\n```\nStepFactory 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. The app parameter provides access to the modular.Application service registry for steps that need it (e.g., db\\_exec, db\\_query, delegate).\n\n```go\ntype TriggerConfigWrapperFunc func(pipelineName string, flatConfig map[string]any) map[string]any\n```\nTriggerConfigWrapperFunc converts flat pipeline trigger config into the trigger's native configuration format (e.g., wrapping {path, method} into {routes: \\[{...}]} for HTTP triggers).\n\n```go\ntype TriggerFactory func() any\n```\nTriggerFactory creates a trigger instance. The returned value should implement the Trigger interface (module.Trigger: Name, Start, Stop, Configure).\n\n```go\ntype UIPageDef struct {\n\tID                 string `json:\"id\"`\n\tLabel              string `json:\"label\"`\n\tIcon               string `json:\"icon\"`\n\tCategory           string `json:\"category\"` // \"global\", \"workflow\", \"plugin\"\n\tOrder              int    `json:\"order\"`\n\tRequiredRole       string `json:\"requiredRole,omitempty\"`       // minimum role: \"viewer\", \"editor\", \"admin\", \"operator\"\n\tRequiredPermission string `json:\"requiredPermission,omitempty\"` // specific permission key, e.g. \"plugins.manage\"\n\tAPIEndpoint        string `json:\"apiEndpoint,omitempty\"`        // JSON data source for template pages\n\tTemplate           string `json:\"template,omitempty\"`           // predefined template: \"data-table\", \"chart-dashboard\", \"form\", \"detail-view\"\n}\n```\nUIPageDef describes a UI page contributed by a plugin.\n\n```go\ntype WiringHook struct {\n\tName     string\n\tPriority int // higher priority runs first\n\tHook     func(app modular.Application, cfg *config.WorkflowConfig) error\n}\n```\nWiringHook wires cross-module integrations.\n\n```go\ntype WorkflowHandlerFactory func() any\n```\nWorkflowHandlerFactory creates a workflow handler instance. The returned value should implement WorkflowHandler (CanHandle, ConfigureWorkflow, ExecuteWorkflow).\n\n```go\ntype WorkflowPlugin interface {\n\tNativePlugin\n\tEmbeddedWorkflows() []EmbeddedWorkflow\n}\n```\nWorkflowPlugin extends NativePlugin with the ability to contribute embedded workflows that can be invoked as sub-workflows from pipelines.\n\n","path":"github.com/GoCodeAlone/workflow/plugin","name":"plugin","synopsis":"Package plugin contains Workflow's plugin manifest, registry, loading, and installation primitives.","isRedistributable":true}
