Documentation
¶
Index ¶
- type Engine
- type EngineBuilderFunc
- type ManagedEngine
- type ModuleFactory
- type StartStopModule
- type StdEngine
- func (e *StdEngine) AddModuleType(moduleType string, factory ModuleFactory)
- func (e *StdEngine) BuildFromConfig(cfg *config.WorkflowConfig) error
- func (e *StdEngine) GetApp() modular.Application
- func (e *StdEngine) RegisterTrigger(trigger module.Trigger)
- func (e *StdEngine) RegisterWorkflowHandler(handler WorkflowHandler)
- func (e *StdEngine) SetDynamicLoader(loader *dynamic.Loader)
- func (e *StdEngine) SetDynamicRegistry(registry *dynamic.ComponentRegistry)
- 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, ...) 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 module.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]interface{}) 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 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) 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) RegisterTrigger ¶
RegisterTrigger registers a trigger with the engine
func (*StdEngine) RegisterWorkflowHandler ¶
func (e *StdEngine) RegisterWorkflowHandler(handler WorkflowHandler)
RegisterWorkflowHandler adds a workflow handler to the engine
func (*StdEngine) SetDynamicLoader ¶
SetDynamicLoader sets the dynamic component loader on the engine. When set, dynamic.component modules can load from source files via the "source" config key.
func (*StdEngine) SetDynamicRegistry ¶
func (e *StdEngine) SetDynamicRegistry(registry *dynamic.ComponentRegistry)
SetDynamicRegistry sets the dynamic component registry 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 interface{}) error
// ExecuteWorkflow executes a workflow with the given action and input data
ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]interface{}) (map[string]interface{}, 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
|
|
|
Package handlers provides workflow handling capabilities
|
Package handlers provides workflow handling capabilities |
|
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 |