Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
// contains filtered or unexported fields
}
Environment wraps a cel.Env configured for a specific workflow, together with the list of participant names that were declared as variables.
func NewEnv ¶
func NewEnv(wf *model.Workflow) (*Environment, error)
NewEnv builds a CEL environment for the given workflow, declaring all runtime variable types so that expressions can be type-checked at parse/lint time.
func (*Environment) Bindings ¶
func (e *Environment) Bindings(s *State) map[string]any
Bindings converts a State into a flat map suitable for passing to cel.Program.Eval. Participants that have not yet produced a result are included with an empty map so that declared variables are always present in the activation.
func (*Environment) Compile ¶
func (e *Environment) Compile(expr string) (gcel.Program, error)
Compile parses and type-checks the CEL expression, returning a compiled Program ready for repeated evaluation. Call this at parse/lint time to surface syntax and type errors early.
Occurrences of "loop." in expr are automatically rewritten to "_loop." before compilation because "loop" is a reserved identifier in the CEL grammar.
func (*Environment) Eval ¶
Eval evaluates a pre-compiled Program against the given runtime State and returns the result as a native Go value. Type coercion is handled by the CEL runtime; the result is unwrapped to its underlying Go representation.
func (*Environment) PrecompileWorkflow ¶
func (e *Environment) PrecompileWorkflow(wf *model.Workflow) error
PrecompileWorkflow compiles all CEL expressions used by the workflow runtime so execution can reuse cached programs via Environment.Compile.
type ExecutionMeta ¶
type ExecutionMeta struct {
ID string
Number int64
StartedAt string
Status string
CWD string
Context map[string]any
}
ExecutionMeta holds execution metadata available under the "execution" variable.
type LoopContext ¶
LoopContext holds loop iteration variables available as "loop.*" inside a loop body (e.g. `loop.index`, `loop.first`). Internally, the runner rewrites "loop." to "_loop." before passing expressions to the CEL compiler, because "loop" is a reserved keyword in the CEL grammar.
type State ¶
type State struct {
Workflow WorkflowMeta
Execution ExecutionMeta
// WorkflowInputs holds the workflow-level inputs, accessible as workflow.inputs.*
WorkflowInputs map[string]any
// WorkflowOutput holds the resolved workflow output, accessible as workflow.output
WorkflowOutput any
// CurrentInput holds the current participant's input (chain + explicit merged),
// accessible as the CEL variable "input".
CurrentInput any
// CurrentOutput holds the current participant's output after execution,
// accessible as the CEL variable "output".
CurrentOutput any
Env map[string]string
Steps map[string]*StepResult
// EventPayload holds data from an event when running wait.event steps.
// It is set by runWait after a matching event is received from the hub.
EventPayload any
// Now is injected by the engine as a timestamp for expressions.
Now time.Time
Loop *LoopContext
// contains filtered or unexported fields
}
State holds all runtime variable data used to evaluate CEL expressions. The mu field protects concurrent reads and writes to Steps during parallel step execution.
func (*State) SetStep ¶
func (s *State) SetStep(name string, result *StepResult)
SetStep stores a step result thread-safely. It is the only permitted way to write to Steps so that parallel goroutines do not race on the map.
type StepResult ¶
type StepResult struct {
Output any
Status string
Retries int64
StartedAt string
FinishedAt string
Duration string
Error string
// CWD is the effective current working directory used when running exec participants.
CWD string
}
StepResult holds the result of a completed participant step. It is available in expressions as "<participant-name>.output", "<participant-name>.status", etc.
type WorkflowMeta ¶
WorkflowMeta holds workflow metadata available under the "workflow" variable.