runner

package
v0.0.0-...-837652e Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFlowRunnerNotImplemented = errors.New("flowrunner not implemented")
	ErrNodeNotFound             = errors.New("next node not found")
)
View Source
var ErrFlowCanceledByThrow = errors.New("flow canceled by throw")

ErrFlowCanceledByThrow marks an intentional cancellation triggered by a node (e.g., via a user throw). When a loop node propagates this error, the runner should mark the loop as CANCELED, not FAILURE.

Functions

func FlowStatusString

func FlowStatusString(f FlowStatus) string

func FlowStatusStringWithIcons

func FlowStatusStringWithIcons(f FlowStatus) string

func IsCancellationError

func IsCancellationError(err error) bool

IsCancellationError returns true if the error represents a cancellation (explicit throw or context cancellation).

func IsFlowStatusDone

func IsFlowStatusDone(f FlowStatus) bool

Types

type FlowEventChannels

type FlowEventChannels struct {
	NodeStates chan FlowNodeStatus
	NodeLogs   chan FlowNodeLogPayload
	FlowStatus chan FlowStatus
}

func LegacyFlowEventChannels

func LegacyFlowEventChannels(nodeStates chan FlowNodeStatus, flowStatus chan FlowStatus) FlowEventChannels

func (FlowEventChannels) HasLogChannel

func (c FlowEventChannels) HasLogChannel() bool

type FlowNodeEvent

type FlowNodeEvent struct {
	Status     FlowNodeStatus
	Targets    FlowNodeEventTarget
	LogPayload *FlowNodeLogPayload
}

func (FlowNodeEvent) ShouldSend

func (e FlowNodeEvent) ShouldSend(target FlowNodeEventTarget) bool

type FlowNodeEventTarget

type FlowNodeEventTarget uint8
const (
	FlowNodeEventTargetState FlowNodeEventTarget = 1 << iota
	FlowNodeEventTargetLog
)

type FlowNodeLogPayload

type FlowNodeLogPayload struct {
	ExecutionID      idwrap.IDWrap
	NodeID           idwrap.IDWrap
	Name             string
	State            mflow.NodeState
	Error            error
	OutputData       any
	RunDuration      time.Duration
	IterationContext *IterationContext
	IterationEvent   bool
	IterationIndex   int
	LoopNodeID       idwrap.IDWrap
}

type FlowNodeStatus

type FlowNodeStatus struct {
	ExecutionID      idwrap.IDWrap
	NodeID           idwrap.IDWrap
	Name             string
	State            mflow.NodeState
	OutputData       any
	InputData        any // Data that was read by this node during execution
	RunDuration      time.Duration
	Error            error
	IterationContext *IterationContext `json:"iteration_context,omitempty"`
	IterationEvent   bool              `json:"iteration_event,omitempty"`
	IterationIndex   int               `json:"iteration_index,omitempty"`
	LoopNodeID       idwrap.IDWrap     `json:"loop_node_id,omitempty"`
	AuxiliaryID      *idwrap.IDWrap
}

func NewFlowNodeStatus

func NewFlowNodeStatus(nodeID idwrap.IDWrap, status mflow.NodeState, output []byte) FlowNodeStatus

type FlowRunner

type FlowRunner interface {
	RunWithEvents(context.Context, FlowEventChannels, map[string]any) error
}

type FlowStatus

type FlowStatus int8
const (
	FlowStatusStarting FlowStatus = iota
	FlowStatusRunning
	FlowStatusSuccess
	FlowStatusFailed
	FlowStatusTimeout
)

type IterationContext

type IterationContext struct {
	IterationPath  []int            `json:"iteration_path"`         // [1, 2, 3] for nested loops
	ExecutionIndex int              `json:"execution_index"`        // Current execution within current loop
	ParentNodes    []idwrap.IDWrap  `json:"parent_nodes,omitempty"` // Parent loop node IDs for hierarchical naming
	Labels         []IterationLabel `json:"labels,omitempty"`
}

type IterationLabel

type IterationLabel struct {
	NodeID    idwrap.IDWrap `json:"node_id"`
	Name      string        `json:"name"`
	Iteration int           `json:"iteration"`
}

IterationLabel captures a single segment of a loop execution chain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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