Documentation
¶
Index ¶
- type Engine
- type EngineBuilderFunc
- type ManagedEngine
- type ModuleFactory
- type PipelineAdder
- type RoutePipelineSetter
- type StartStopModule
- type StdEngine
- func (e *StdEngine) AddModuleType(moduleType string, factory ModuleFactory)
- func (e *StdEngine) AddStepType(stepType string, factory module.StepFactory)
- func (e *StdEngine) App() modular.Application
- func (e *StdEngine) BuildFromApplicationConfig(appCfg *config.ApplicationConfig) error
- func (e *StdEngine) BuildFromConfig(cfg *config.WorkflowConfig) error
- func (e *StdEngine) GetApp() modular.Application
- func (e *StdEngine) GetStepRegistry() *module.StepRegistry
- func (e *StdEngine) LoadPlugin(p plugin.EnginePlugin) error
- func (e *StdEngine) LoadedPlugins() []plugin.EnginePlugin
- func (e *StdEngine) PluginLoader() *plugin.PluginLoader
- func (e *StdEngine) RegisterTrigger(trigger interfaces.Trigger)
- func (e *StdEngine) RegisterTriggerConfigWrapper(triggerType string, wrapper plugin.TriggerConfigWrapperFunc)
- func (e *StdEngine) RegisterTriggerType(triggerType string, triggerName string)
- func (e *StdEngine) RegisterWorkflowHandler(handler WorkflowHandler)
- func (e *StdEngine) SecretsResolver() *secrets.MultiResolver
- func (e *StdEngine) SetDynamicLoader(loader *dynamic.Loader)
- func (e *StdEngine) SetDynamicRegistry(registry *dynamic.ComponentRegistry)
- func (e *StdEngine) SetPluginInstaller(installer *plugin.PluginInstaller)
- func (e *StdEngine) SetPluginLoader(loader *plugin.PluginLoader)
- func (e *StdEngine) Start(ctx context.Context) error
- func (e *StdEngine) Stop(ctx context.Context) error
- func (e *StdEngine) TriggerWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) error
- type WorkflowEngineManager
- func (m *WorkflowEngineManager) DeployWorkflow(ctx context.Context, workflowID uuid.UUID) error
- func (m *WorkflowEngineManager) GetStatus(workflowID uuid.UUID) (*WorkflowStatus, error)
- func (m *WorkflowEngineManager) ListActive() []WorkflowStatus
- func (m *WorkflowEngineManager) ReloadWorkflow(ctx context.Context, workflowID uuid.UUID) error
- func (m *WorkflowEngineManager) Router() *module.CrossWorkflowRouter
- func (m *WorkflowEngineManager) StopAll(ctx context.Context) error
- func (m *WorkflowEngineManager) StopWorkflow(ctx context.Context, workflowID uuid.UUID) error
- type WorkflowHandler
- type WorkflowStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine interface {
RegisterWorkflowHandler(handler WorkflowHandler)
RegisterTrigger(trigger interfaces.Trigger)
AddModuleType(moduleType string, factory ModuleFactory)
BuildFromConfig(cfg *config.WorkflowConfig) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
TriggerWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) error
}
type EngineBuilderFunc ¶
type EngineBuilderFunc func(cfg *config.WorkflowConfig, logger *slog.Logger) (*StdEngine, modular.Application, error)
EngineBuilderFunc is called by the manager to create and configure an engine from a parsed workflow config. The caller is responsible for registering workflow handlers, dynamic components, and other setup. The function must call BuildFromConfig on the engine before returning.
type ManagedEngine ¶
type ManagedEngine struct {
WorkflowID uuid.UUID
Engine *StdEngine
App modular.Application
Status string // "running", "stopped", "error"
StartedAt time.Time
Error error
// contains filtered or unexported fields
}
ManagedEngine holds a running workflow engine along with its metadata.
func (*ManagedEngine) GetEngine ¶
func (me *ManagedEngine) GetEngine() module.TriggerWorkflower
GetEngine returns the underlying engine, satisfying the module.triggerableEngine interface so the CrossWorkflowRouter can trigger workflows via duck-typing.
type ModuleFactory ¶
ModuleFactory is a function that creates a module from a name and configuration
type PipelineAdder ¶
type PipelineAdder interface {
AddPipeline(name string, p interfaces.PipelineRunner)
}
PipelineAdder is implemented by workflow handlers that can receive named pipelines. This allows the engine to add pipelines without importing the handlers package.
type RoutePipelineSetter ¶
type RoutePipelineSetter interface {
SetRoutePipeline(routePath string, pipeline interfaces.PipelineRunner)
}
buildPipelineSteps creates PipelineStep instances from step configurations. RoutePipelineSetter is implemented by handlers (QueryHandler, CommandHandler) that support per-route pipelines.
type StartStopModule ¶
type StartStopModule interface {
modular.Module
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
StartStopModule extends the basic Module interface with lifecycle methods
type StdEngine ¶
type StdEngine struct {
// contains filtered or unexported fields
}
StdEngine represents the workflow execution engine
func NewStdEngine ¶
func NewStdEngine(app modular.Application, logger modular.Logger) *StdEngine
NewStdEngine creates a new workflow engine
func (*StdEngine) AddModuleType ¶
func (e *StdEngine) AddModuleType(moduleType string, factory ModuleFactory)
AddModuleType registers a factory function for a module type
func (*StdEngine) AddStepType ¶
func (e *StdEngine) AddStepType(stepType string, factory module.StepFactory)
AddStepType registers a pipeline step factory for the given step type.
func (*StdEngine) App ¶
func (e *StdEngine) App() modular.Application
App returns the underlying modular.Application.
func (*StdEngine) BuildFromApplicationConfig ¶ added in v0.1.6
func (e *StdEngine) BuildFromApplicationConfig(appCfg *config.ApplicationConfig) error
BuildFromApplicationConfig loads a multi-workflow application config and builds the engine from all referenced workflow configs. Each workflow config file is parsed independently, and their modules are merged into the shared module registry. Module name conflicts across workflow files produce a clear error.
This is the entry point for the application-level multi-workflow feature:
application:
name: chat-platform
workflows:
- file: workflows/main-loop.yaml
- file: workflows/queue-assignment.yaml
All pipelines defined across workflow files share a single engine and can call each other using step.workflow_call.
func (*StdEngine) BuildFromConfig ¶
func (e *StdEngine) BuildFromConfig(cfg *config.WorkflowConfig) error
BuildFromConfig builds a workflow from configuration
func (*StdEngine) GetApp ¶
func (e *StdEngine) GetApp() modular.Application
GetApp returns the underlying modular Application.
func (*StdEngine) GetStepRegistry ¶
func (e *StdEngine) GetStepRegistry() *module.StepRegistry
GetStepRegistry returns the engine's pipeline step registry.
func (*StdEngine) LoadPlugin ¶
func (e *StdEngine) LoadPlugin(p plugin.EnginePlugin) error
LoadPlugin loads an EnginePlugin into the engine.
func (*StdEngine) LoadedPlugins ¶
func (e *StdEngine) LoadedPlugins() []plugin.EnginePlugin
LoadedPlugins returns all engine plugins that were loaded via LoadPlugin.
func (*StdEngine) PluginLoader ¶
func (e *StdEngine) PluginLoader() *plugin.PluginLoader
PluginLoader returns the engine's plugin loader, creating it lazily if needed.
func (*StdEngine) RegisterTrigger ¶
func (e *StdEngine) RegisterTrigger(trigger interfaces.Trigger)
RegisterTrigger registers a trigger with the engine
func (*StdEngine) RegisterTriggerConfigWrapper ¶
func (e *StdEngine) RegisterTriggerConfigWrapper(triggerType string, wrapper plugin.TriggerConfigWrapperFunc)
RegisterTriggerConfigWrapper registers a function that converts flat pipeline trigger config into the native format for a given trigger type.
func (*StdEngine) RegisterTriggerType ¶
RegisterTriggerType registers a mapping from a trigger config type key (e.g., "reconciliation") to a trigger Name() (e.g., "trigger.reconciliation"). This is used for triggers registered directly via RegisterTrigger() rather than through a plugin's TriggerFactories().
func (*StdEngine) RegisterWorkflowHandler ¶
func (e *StdEngine) RegisterWorkflowHandler(handler WorkflowHandler)
RegisterWorkflowHandler adds a workflow handler to the engine
func (*StdEngine) SecretsResolver ¶
func (e *StdEngine) SecretsResolver() *secrets.MultiResolver
SecretsResolver returns the engine's multi-provider secrets resolver.
func (*StdEngine) SetDynamicLoader ¶
SetDynamicLoader sets the dynamic component loader on the engine and propagates it to any loaded plugins that support it.
func (*StdEngine) SetDynamicRegistry ¶
func (e *StdEngine) SetDynamicRegistry(registry *dynamic.ComponentRegistry)
SetDynamicRegistry sets the dynamic component registry on the engine and propagates it to any loaded plugins that support it.
func (*StdEngine) SetPluginInstaller ¶
func (e *StdEngine) SetPluginInstaller(installer *plugin.PluginInstaller)
SetPluginInstaller sets the plugin installer on the engine, enabling auto-installation of required plugins during validateRequirements.
func (*StdEngine) SetPluginLoader ¶
func (e *StdEngine) SetPluginLoader(loader *plugin.PluginLoader)
SetPluginLoader sets a custom plugin loader on the engine.
type WorkflowEngineManager ¶
type WorkflowEngineManager struct {
// contains filtered or unexported fields
}
WorkflowEngineManager manages multiple concurrent workflow engine instances.
func NewWorkflowEngineManager ¶
func NewWorkflowEngineManager(wfStore store.WorkflowStore, linkStore store.CrossWorkflowLinkStore, logger *slog.Logger, engineBuilder EngineBuilderFunc) *WorkflowEngineManager
NewWorkflowEngineManager creates a new manager for workflow engine instances. The engineBuilder function is called to create each new engine instance, allowing the caller to register handlers and configure the dynamic system.
func (*WorkflowEngineManager) DeployWorkflow ¶
DeployWorkflow loads config from the store, creates an isolated engine, and starts it.
func (*WorkflowEngineManager) GetStatus ¶
func (m *WorkflowEngineManager) GetStatus(workflowID uuid.UUID) (*WorkflowStatus, error)
GetStatus returns the runtime status of a workflow.
func (*WorkflowEngineManager) ListActive ¶
func (m *WorkflowEngineManager) ListActive() []WorkflowStatus
ListActive returns the status of all running workflows.
func (*WorkflowEngineManager) ReloadWorkflow ¶
ReloadWorkflow stops and redeploys a workflow.
func (*WorkflowEngineManager) Router ¶
func (m *WorkflowEngineManager) Router() *module.CrossWorkflowRouter
Router returns the cross-workflow event router.
func (*WorkflowEngineManager) StopAll ¶
func (m *WorkflowEngineManager) StopAll(ctx context.Context) error
StopAll gracefully stops all running engines.
func (*WorkflowEngineManager) StopWorkflow ¶
StopWorkflow gracefully stops a running engine.
type WorkflowHandler ¶
type WorkflowHandler interface {
// CanHandle returns true if this handler can process the given workflow type
CanHandle(workflowType string) bool
// ConfigureWorkflow sets up the workflow from configuration
ConfigureWorkflow(app modular.Application, workflowConfig any) error
// ExecuteWorkflow executes a workflow with the given action and input data
ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)
}
WorkflowHandler interface for handling different workflow types
type WorkflowStatus ¶
type WorkflowStatus struct {
WorkflowID uuid.UUID `json:"workflow_id"`
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
Uptime time.Duration `json:"uptime"`
Error string `json:"error,omitempty"`
ModuleCount int `json:"module_count"`
}
WorkflowStatus describes the current runtime state of a managed workflow.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
Package examples contains complete examples of AI-generated workflows.
|
Package examples contains complete examples of AI-generated workflows. |
|
cmd
|
|
|
server
command
|
|
|
wfctl
command
|
|
|
Package debug provides interactive workflow debugging with breakpoint support, step-through execution, and state inspection.
|
Package debug provides interactive workflow debugging with breakpoint support, step-through execution, and state inspection. |
|
examples
|
|
|
external-plugin
command
Package main implements an example external plugin that provides a single step type "step.uppercase" which converts input strings to uppercase.
|
Package main implements an example external plugin that provides a single step type "step.uppercase" which converts input strings to uppercase. |
|
Package handlers provides workflow handling capabilities
|
Package handlers provides workflow handling capabilities |
|
Package interfaces defines shared interface types used across the workflow engine, handlers, and module packages.
|
Package interfaces defines shared interface types used across the workflow engine, handlers, and module packages. |
|
Package licensing provides license validation and feature gating for the workflow engine.
|
Package licensing provides license validation and feature gating for the workflow engine. |
|
Package manifest provides static analysis of WorkflowConfig to produce infrastructure requirements manifests.
|
Package manifest provides static analysis of WorkflowConfig to produce infrastructure requirements manifests. |
|
Package migration provides a migration management system with schema providers, distributed locking, and a migration runner for applying database schema changes.
|
Package migration provides a migration management system with schema providers, distributed locking, and a migration runner for applying database schema changes. |
|
Package mock provides common mock implementations for testing
|
Package mock provides common mock implementations for testing |
|
Package module defines core interfaces for the workflow engine
|
Package module defines core interfaces for the workflow engine |
|
Package platform defines the core types and interfaces for the platform abstraction layer.
|
Package platform defines the core types and interfaces for the platform abstraction layer. |
|
middleware
Package middleware provides HTTP middleware for the platform abstraction layer.
|
Package middleware provides HTTP middleware for the platform abstraction layer. |
|
providers/dockercompose
Package dockercompose implements a platform.Provider that maps abstract capability declarations to Docker Compose services, networks, and volumes.
|
Package dockercompose implements a platform.Provider that maps abstract capability declarations to Docker Compose services, networks, and volumes. |
|
providers/dockercompose/drivers
Package drivers provides resource driver implementations for the Docker Compose provider.
|
Package drivers provides resource driver implementations for the Docker Compose provider. |
|
providers/mock
Package mock provides configurable test doubles for all platform interfaces.
|
Package mock provides configurable test doubles for all platform interfaces. |
|
state
Package state provides persistent StateStore implementations for the platform abstraction layer.
|
Package state provides persistent StateStore implementations for the platform abstraction layer. |
|
admincore
Package admincore provides a NativePlugin that declares the core admin UI pages (Dashboard, Editor, Executions, Logs, Events, Marketplace, Templates, Environments, Settings).
|
Package admincore provides a NativePlugin that declares the core admin UI pages (Dashboard, Editor, Executions, Logs, Events, Marketplace, Templates, Environments, Settings). |
|
ai/anthropic
Package anthropic provides an AIProvider implementation for the Anthropic Claude API.
|
Package anthropic provides an AIProvider implementation for the Anthropic Claude API. |
|
ai/generic
Package generic provides an AIProvider implementation for any OpenAI-compatible API.
|
Package generic provides an AIProvider implementation for any OpenAI-compatible API. |
|
ai/openai
Package openai provides an AIProvider implementation for the OpenAI API.
|
Package openai provides an AIProvider implementation for the OpenAI API. |
|
external
Package external provides gRPC-based external plugin support for the workflow engine.
|
Package external provides gRPC-based external plugin support for the workflow engine. |
|
external/sdk
Package sdk provides the public API for building external workflow plugins.
|
Package sdk provides the public API for building external workflow plugins. |
|
plugins
|
|
|
ai
Package ai provides a plugin that registers AI pipeline step types (ai_complete, ai_classify, ai_extract), the dynamic.component module type, and the sub_workflow step.
|
Package ai provides a plugin that registers AI pipeline step types (ai_complete, ai_classify, ai_extract), the dynamic.component module type, and the sub_workflow step. |
|
cicd
Package cicd provides a plugin that registers CI/CD pipeline step types: shell_exec, artifact_pull, artifact_push, docker_build, docker_push, docker_run, scan_sast, scan_container, scan_deps, deploy, gate, build_ui.
|
Package cicd provides a plugin that registers CI/CD pipeline step types: shell_exec, artifact_pull, artifact_push, docker_build, docker_push, docker_run, scan_sast, scan_container, scan_deps, deploy, gate, build_ui. |
|
dlq
Package dlq provides a plugin that registers the dlq.service module type for config-driven dead letter queue initialization.
|
Package dlq provides a plugin that registers the dlq.service module type for config-driven dead letter queue initialization. |
|
eventstore
Package eventstore provides a plugin that registers the eventstore.service module type for config-driven event store initialization.
|
Package eventstore provides a plugin that registers the eventstore.service module type for config-driven event store initialization. |
|
featureflags
Package featureflags provides a plugin that registers the feature flag service module and associated pipeline steps (feature_flag, ff_gate).
|
Package featureflags provides a plugin that registers the feature flag service module and associated pipeline steps (feature_flag, ff_gate). |
|
integration
Package integration provides a plugin that registers the integration workflow handler for connector-based integration workflows.
|
Package integration provides a plugin that registers the integration workflow handler for connector-based integration workflows. |
|
license
Package license provides an EnginePlugin that registers the license.validator module type, which validates licenses against a remote server and gates premium plugin access.
|
Package license provides an EnginePlugin that registers the license.validator module type, which validates licenses against a remote server and gates premium plugin access. |
|
messaging
Package messaging provides an EnginePlugin that registers all messaging-related module types, trigger types, workflow handlers, and schemas.
|
Package messaging provides an EnginePlugin that registers all messaging-related module types, trigger types, workflow handlers, and schemas. |
|
modularcompat
Package modularcompat provides a plugin that registers CrisisTextLine/modular framework module adapters: scheduler.modular, cache.modular.
|
Package modularcompat provides a plugin that registers CrisisTextLine/modular framework module adapters: scheduler.modular, cache.modular. |
|
observability
Package observability provides an EnginePlugin that contributes all observability-related module types: metrics collector, health checker, log collector, OpenTelemetry tracing, and OpenAPI generator/consumer.
|
Package observability provides an EnginePlugin that contributes all observability-related module types: metrics collector, health checker, log collector, OpenTelemetry tracing, and OpenAPI generator/consumer. |
|
openapi
Package openapi provides the OpenAPI module plugin for the workflow engine.
|
Package openapi provides the OpenAPI module plugin for the workflow engine. |
|
pipelinesteps
Package pipelinesteps provides a plugin that registers generic pipeline step types: validate, transform, conditional, set, log, delegate, jq, publish, http_call, request_parse, db_query, db_exec, json_response, validate_path_param, validate_pagination, validate_request_body.
|
Package pipelinesteps provides a plugin that registers generic pipeline step types: validate, transform, conditional, set, log, delegate, jq, publish, http_call, request_parse, db_query, db_exec, json_response, validate_path_param, validate_pagination, validate_request_body. |
|
platform
Package platform provides an EnginePlugin that registers all platform-related module types, the platform workflow handler, the reconciliation trigger, and the platform template step.
|
Package platform provides an EnginePlugin that registers all platform-related module types, the platform workflow handler, the reconciliation trigger, and the platform template step. |
|
scheduler
Package scheduler provides a plugin that registers the scheduler workflow handler and the schedule trigger factory.
|
Package scheduler provides a plugin that registers the scheduler workflow handler and the schedule trigger factory. |
|
secrets
Package secrets provides a plugin that registers secrets management modules: secrets.vault (HashiCorp Vault) and secrets.aws (AWS Secrets Manager).
|
Package secrets provides a plugin that registers secrets management modules: secrets.vault (HashiCorp Vault) and secrets.aws (AWS Secrets Manager). |
|
timeline
Package timeline provides a plugin that registers the timeline.service module type for config-driven timeline/replay handler initialization.
|
Package timeline provides a plugin that registers the timeline.service module type for config-driven timeline/replay handler initialization. |
|
Package sandbox provides Docker-based sandboxed execution for CI/CD pipeline steps.
|
Package sandbox provides Docker-based sandboxed execution for CI/CD pipeline steps. |
|
Package schema provides JSON Schema generation and validation for workflow configuration files.
|
Package schema provides JSON Schema generation and validation for workflow configuration files. |