runner

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package runner is the single entrypoint for executing a flow. Every transport — the in-process cloud control plane, the self-hosted job runner, and the ephemeral CLI — drives execution through Run so the orchestration (input merge, referenced-flow module resolution, engine wiring) lives in exactly one place. Transports differ only in their Observer (where progress events go) and in how they serialize the returned result.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeInputs

func MergeInputs(base, override map[string]any) map[string]any

MergeInputs overlays override onto base, returning a new map. base values fill keys the caller did not provide (e.g. flow-declared defaults); override wins.

func ModuleResolver

func ModuleResolver(refs flow.ReferencedFlowRegistry) spi.ModuleResolver

ModuleResolver builds a spi.ModuleResolver from referenced flows. Returns nil when there are none, which the engine treats as "no module targets". This is the single implementation; it replaces the copies that lived in the cloud, self-hosted, and ephemeral transports.

func Retry

func Retry(attempts int) engine.Middleware

Retry re-runs a node up to attempts times while it returns an error, stopping early if the execution context is cancelled. attempts < 1 is treated as 1.

func Run

func Run(flowDef flow.Flow, inputs map[string]any, opts ...Option) (*spi.FlowExecutionResult, error)

Run executes flowDef. It overlays inputs on the flow's declared InitialInputs (inputs win), resolves referenced flows into the module resolver, and runs the engine. The returned result is the single source of truth; callers serialize it as their transport requires.

Run is also the boundary where secret input values are masked: everything the engine hands back — the flow result and every progress event — passes through the redactor before any caller sees it.

func Timeout

func Timeout(d time.Duration) engine.Middleware

Timeout bounds each node execution to d, layered on top of the caller's context. A node that respects its context (HTTP request, delay) aborts when the deadline elapses.

Types

type Option

type Option func(*Options)

Option mutates Options.

func WithContext

func WithContext(ctx context.Context) Option

WithContext propagates a request-scoped context to every node execution (cancellation + deadlines). Defaults to context.Background().

func WithDynamicVars

func WithDynamicVars(d spi.DynamicResolver) Option

WithDynamicVars enables {{$name}} dynamic variable resolution.

func WithMiddleware

func WithMiddleware(middleware ...engine.Middleware) Option

WithMiddleware wraps each node's execution (outermost first). Use the Retry / Timeout helpers or any custom engine.Middleware.

func WithModuleCallStack

func WithModuleCallStack(stack []string) Option

WithModuleCallStack seeds the module-cycle-detection call stack (for nested module execution).

func WithObserver

func WithObserver(obs engine.ExecutionObserver) Option

WithObserver streams progress/terminal events to obs (SSE+DB for cloud, job events for self-hosted, none for ephemeral).

func WithReferencedFlows

func WithReferencedFlows(refs flow.ReferencedFlowRegistry) Option

WithReferencedFlows supplies the child flow definitions module nodes execute without calling back to the control plane.

func WithSecretInputKeys added in v0.50.0

func WithSecretInputKeys(keys []string) Option

WithSecretInputKeys names the inputs whose values are secret. Their values are masked in every result and progress event the run reports.

type Options

type Options struct {
	Observer        engine.ExecutionObserver
	ReferencedFlows flow.ReferencedFlowRegistry
	DynamicVars     spi.DynamicResolver
	ModuleCallStack []string
	Ctx             context.Context
	Middleware      []engine.Middleware
	SecretInputKeys []string
}

Options configures a Run. Use the With* helpers; the zero value runs with a no-op observer, no referenced flows, and no dynamic variables.

Jump to

Keyboard shortcuts

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