Documentation
¶
Index ¶
- func GenerateSchemaString() (string, error)
- func PrintSchema()
- func Validate(recipex string) error
- type ActivityExecution
- type ActivityStatus
- type BaseVisitor
- func (b *BaseVisitor) ShouldTraverseSequenceChildren(node *NodeSequence, path []string) bool
- func (b *BaseVisitor) ShouldTraverseStateChildren(node *NodeState, path []string) bool
- func (b *BaseVisitor) VisitNodeOp(node *NodeOp, path []string) (Node, error)
- func (b *BaseVisitor) VisitNodeSequence(node *NodeSequence, path []string) (Node, error)
- func (b *BaseVisitor) VisitNodeShared(node *NodeShared, path []string) (Node, error)
- func (b *BaseVisitor) VisitNodeState(node *NodeState, path []string) (Node, error)
- func (b *BaseVisitor) VisitRecipe(recipe *Recipe) (Recipe, error)
- func (b *BaseVisitor) VisitRecipeOp(node *RecipeOp, path []string) (*RecipeOp, error)
- func (b *BaseVisitor) VisitRecipeSequence(node *RecipeSequence, path []string) (*RecipeSequence, error)
- func (b *BaseVisitor) VisitRecipeState(node *RecipeState, path []string) (*RecipeState, error)
- type Duration
- type ExtensionFunctionImport
- type ExtensionImports
- type HashComputer
- type InitialTransitions
- func (InitialTransitions) JSONSchema() *jsonschema.Schema
- func (i InitialTransitions) MarshalYAML() (interface{}, error)
- func (i InitialTransitions) ShortcutState() (string, bool)
- func (i InitialTransitions) Transitions() []Transition
- func (i *InitialTransitions) UnmarshalYAML(node *yamlv3.Node) error
- type InputSchema
- type Job
- type JobFilter
- type JobStatus
- type Node
- type NodeImpl
- type NodeList
- type NodeMetadata
- type NodeOp
- type NodeSequence
- type NodeShared
- type NodeState
- type NodeVisitor
- type NodeWalker
- type OpData
- type Recipe
- type RecipeFile
- type RecipeImpl
- type RecipeManifest
- type RecipeMetadata
- type RecipeOp
- type RecipeProvider
- type RecipeSequence
- type RecipeState
- type RetryPolicy
- type SequenceData
- type SharedNodeResolver
- type SingleStateMetadata
- type State
- type StateMachineData
- type StateMap
- type Transition
- type WorkerStatus
- type WorkflowExecutionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSchemaString ¶
func PrintSchema ¶
func PrintSchema()
Types ¶
type ActivityExecution ¶
type ActivityExecution struct {
Name string // Activity name from YAML definition
Status string // Use string for flexibility
StartTime time.Time
EndTime time.Time
Duration *time.Duration
Result map[string]interface{}
Error string
Attempt int
ActivityID string
ActivityType string
}
ActivityExecution represents the execution state of an activity within a job
type ActivityStatus ¶
type ActivityStatus string
ActivityStatus represents the execution status of an activity
const ( ActivityStatusPending ActivityStatus = "pending" ActivityStatusRunning ActivityStatus = "running" ActivityStatusCompleted ActivityStatus = "completed" ActivityStatusFailed ActivityStatus = "failed" ActivityStatusSkipped ActivityStatus = "skipped" )
type BaseVisitor ¶
type BaseVisitor struct {
// contains filtered or unexported fields
}
BaseVisitor provides default pass-through implementations Embed this to only override specific node types you care about
func (*BaseVisitor) ShouldTraverseSequenceChildren ¶
func (b *BaseVisitor) ShouldTraverseSequenceChildren(node *NodeSequence, path []string) bool
Control methods default to true (always traverse)
func (*BaseVisitor) ShouldTraverseStateChildren ¶
func (b *BaseVisitor) ShouldTraverseStateChildren(node *NodeState, path []string) bool
func (*BaseVisitor) VisitNodeOp ¶
func (b *BaseVisitor) VisitNodeOp(node *NodeOp, path []string) (Node, error)
Leaf nodes - just return unchanged
func (*BaseVisitor) VisitNodeSequence ¶
func (b *BaseVisitor) VisitNodeSequence(node *NodeSequence, path []string) (Node, error)
Container nodes - must traverse children
func (*BaseVisitor) VisitNodeShared ¶
func (b *BaseVisitor) VisitNodeShared(node *NodeShared, path []string) (Node, error)
func (*BaseVisitor) VisitNodeState ¶
func (b *BaseVisitor) VisitNodeState(node *NodeState, path []string) (Node, error)
func (*BaseVisitor) VisitRecipe ¶
func (b *BaseVisitor) VisitRecipe(recipe *Recipe) (Recipe, error)
func (*BaseVisitor) VisitRecipeOp ¶
func (b *BaseVisitor) VisitRecipeOp(node *RecipeOp, path []string) (*RecipeOp, error)
Root recipe nodes
func (*BaseVisitor) VisitRecipeSequence ¶
func (b *BaseVisitor) VisitRecipeSequence(node *RecipeSequence, path []string) (*RecipeSequence, error)
func (*BaseVisitor) VisitRecipeState ¶
func (b *BaseVisitor) VisitRecipeState(node *RecipeState, path []string) (*RecipeState, error)
type Duration ¶
Duration wraps time.Duration to provide custom YAML marshaling/unmarshaling It serializes to/from human-readable strings like "1s", "500ms", "2m"
func (Duration) JSONSchema ¶
func (d Duration) JSONSchema() *jsonschema.Schema
func (Duration) MarshalYAML ¶
MarshalYAML converts Duration to a YAML string
func (Duration) ToDuration ¶
ToDuration converts to standard time.Duration
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML parses a YAML string into a Duration
type ExtensionFunctionImport ¶
type ExtensionImports ¶
type ExtensionImports struct {
Functions []ExtensionFunctionImport `yaml:"functions,omitempty"`
}
type HashComputer ¶
type HashComputer struct{}
HashComputer computes canonical hashes for recipes
func NewHashComputer ¶
func NewHashComputer() *HashComputer
NewHashComputer creates a new hash computer
func (*HashComputer) ComputeRecipeHash ¶
func (h *HashComputer) ComputeRecipeHash(recipe *Recipe) string
ComputeRecipeHash computes a deterministic hash of recipe content
type InitialTransitions ¶
type InitialTransitions []Transition
InitialTransitions represents the transition block used to choose the first state. YAML supports:
- `initial: state_name` (shorthand)
- `initial: {to: state_name, when: ...}`
- `initial: [{to: state_a, when: ...}, ...]`
func InitialState ¶
func InitialState(stateName string) InitialTransitions
InitialState returns the shorthand initial transition to a named state.
func (InitialTransitions) JSONSchema ¶
func (InitialTransitions) JSONSchema() *jsonschema.Schema
func (InitialTransitions) MarshalYAML ¶
func (i InitialTransitions) MarshalYAML() (interface{}, error)
func (InitialTransitions) ShortcutState ¶
func (i InitialTransitions) ShortcutState() (string, bool)
func (InitialTransitions) Transitions ¶
func (i InitialTransitions) Transitions() []Transition
func (*InitialTransitions) UnmarshalYAML ¶
func (i *InitialTransitions) UnmarshalYAML(node *yamlv3.Node) error
type InputSchema ¶
type InputSchema struct {
Type string `yaml:"type,omitempty"` // Type of the input (string, number, boolean, etc.)
Description string `yaml:"description,omitempty"` // Description of the input
Required bool `yaml:"required,omitempty"` // Whether the input is required
Default interface{} `yaml:"default_value,omitempty" jsonschema:"oneof_type=string;number"` // Default value if not provided
}
InputSchema defines the schema for an input parameter
type Job ¶
type Job struct {
ID string
RecipeName string
RecipeVersion string
Status JobStatus
StartTime time.Time
EndTime *time.Time
UpdateTime time.Time
Input map[string]interface{}
Output map[string]interface{}
Error string
// Optional fields
Duration *time.Duration
Inputs map[string]interface{} // alias for Input
Outputs map[string]interface{} // alias for Output
Activities []*ActivityExecution
WorkflowType string
ExecutionInfo *WorkflowExecutionInfo
}
Job represents an execution instance of a recipe
type JobFilter ¶
type JobFilter struct {
RecipeName string
Status *JobStatus
StartTime *time.Time
EndTime *time.Time
Limit int
}
JobFilter represents filter criteria for listing jobs
type Node ¶
type Node struct {
NodeImpl
}
func (Node) GetMetadata ¶
func (n Node) GetMetadata() NodeMetadata
func (Node) JSONSchema ¶
func (Node) JSONSchema() *jsonschema.Schema
func (Node) MarshalYAML ¶
MarshalYAML ensures Node marshals to the same shape expected by UnmarshalYAML by delegating directly to the underlying concrete implementation.
type NodeImpl ¶
type NodeImpl interface {
GetMetadata() NodeMetadata
// contains filtered or unexported methods
}
type NodeMetadata ¶
type NodeMetadata struct {
ID string `yaml:"id,omitempty"`
Desc string `yaml:"desc,omitempty"`
Const bool `yaml:"const,omitempty"`
Timeout Duration `yaml:"timeout,omitempty"`
Retry *RetryPolicy `yaml:"retry,omitempty"`
Inputs map[string]interface{} `yaml:"inputs,omitempty"`
Vars map[string]interface{} `yaml:"vars,omitempty"`
Artifacts map[string]interface{} `yaml:"artifacts,omitempty"`
When cel.CELExpr `yaml:"when,omitempty"` // Conditional execution
}
type NodeOp ¶
type NodeOp struct {
NodeMetadata `yaml:",inline"`
OpData `yaml:",inline"`
}
func (*NodeOp) GetMetadata ¶
func (n *NodeOp) GetMetadata() NodeMetadata
func (NodeOp) JSONSchema ¶
func (NodeOp) JSONSchema() *jsonschema.Schema
type NodeSequence ¶
type NodeSequence struct {
NodeMetadata `yaml:",inline"`
SequenceData `yaml:",inline"`
}
func (*NodeSequence) GetMetadata ¶
func (n *NodeSequence) GetMetadata() NodeMetadata
type NodeShared ¶
type NodeShared struct {
}
func (*NodeShared) GetMetadata ¶
func (n *NodeShared) GetMetadata() NodeMetadata
type NodeState ¶
type NodeState struct {
NodeMetadata `yaml:",inline"`
StateMachineData `yaml:",inline"`
}
func (*NodeState) GetMetadata ¶
func (n *NodeState) GetMetadata() NodeMetadata
type NodeVisitor ¶
type NodeVisitor interface {
// Root node visitors - return (replacement, error)
VisitRecipe(recipe *Recipe) (Recipe, error)
VisitRecipeOp(node *RecipeOp, path []string) (*RecipeOp, error)
VisitRecipeSequence(node *RecipeSequence, path []string) (*RecipeSequence, error)
VisitRecipeState(node *RecipeState, path []string) (*RecipeState, error)
// Intermediate node visitors - return (replacement, error)
VisitNodeOp(node *NodeOp, path []string) (Node, error)
VisitNodeSequence(node *NodeSequence, path []string) (Node, error)
VisitNodeState(node *NodeState, path []string) (Node, error)
// Control whether to traverse children of container nodes
ShouldTraverseSequenceChildren(node *NodeSequence, path []string) bool
ShouldTraverseStateChildren(node *NodeState, path []string) bool
}
NodeVisitor defines the interface for visiting and transforming recipe node trees
type NodeWalker ¶
type NodeWalker struct {
// contains filtered or unexported fields
}
NodeWalker orchestrates the traversal of a recipe tree
func NewNodeWalker ¶
func NewNodeWalker(visitor NodeVisitor) *NodeWalker
NewNodeWalker creates a new walker with the given visitor
type Recipe ¶
type Recipe struct {
RecipeImpl
}
func LoadRecipeFromString ¶
func (Recipe) GetMetdata ¶
func (r Recipe) GetMetdata() RecipeMetadata
func (Recipe) JSONSchema ¶
func (Recipe) JSONSchema() *jsonschema.Schema
func (*Recipe) MarshalYAML ¶
type RecipeFile ¶
type RecipeFile struct {
// Core identity
ID string
Version string
Description string
// File paths
BasePath string // Directory containing the recipe
// Content
Recipe Recipe
// Metadata
Hash string // Canonical hash of recipe content
LastModified time.Time
}
Recipe represents a discovered recipe with its metadata
type RecipeImpl ¶
type RecipeImpl interface {
GetMetadata() RecipeMetadata
// contains filtered or unexported methods
}
type RecipeManifest ¶
type RecipeManifest struct {
Recipe struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Files struct {
Workflow string `yaml:"workflow"`
Activities string `yaml:"activities"`
Agents string `yaml:"agents"`
} `yaml:"files"`
} `yaml:"recipe"`
}
RecipeManifest represents the recipe.yaml structure
type RecipeMetadata ¶
type RecipeMetadata struct {
Version string `yaml:"version"`
NodeMetadata `yaml:",inline"`
Defs map[string]Node `yaml:"defs,omitempty"` // Shared node definitions
InputSchema map[string]InputSchema `yaml:"input_schema,omitempty"` // Optional schema for inputs
Extensions ExtensionImports `yaml:"extensions,omitempty"`
}
func (RecipeMetadata) ValidateInputShapeAndFillDefaults ¶
func (n RecipeMetadata) ValidateInputShapeAndFillDefaults(data map[string]interface{}) (map[string]interface{}, error)
type RecipeOp ¶
type RecipeOp struct {
RecipeMetadata `yaml:",inline" refer:"true"`
OpData `yaml:",inline" refer:"true"`
}
func (*RecipeOp) GetMetadata ¶
func (r *RecipeOp) GetMetadata() RecipeMetadata
type RecipeProvider ¶
type RecipeSequence ¶
type RecipeSequence struct {
RecipeMetadata `yaml:",inline" refer:"true"`
SequenceData `yaml:",inline" refer:"true"`
}
func (*RecipeSequence) GetMetadata ¶
func (r *RecipeSequence) GetMetadata() RecipeMetadata
type RecipeState ¶
type RecipeState struct {
RecipeMetadata `yaml:",inline" refer:"true"`
StateMachineData `yaml:",inline" refer:"true"`
}
func (*RecipeState) GetMetadata ¶
func (r *RecipeState) GetMetadata() RecipeMetadata
type RetryPolicy ¶
type RetryPolicy = swf.RetryPolicy
type SequenceData ¶
type SharedNodeResolver ¶
type SharedNodeResolver struct {
// contains filtered or unexported fields
}
SharedNodeResolver resolves SharedNode references to their definitions
func NewSharedNodeResolver ¶
func NewSharedNodeResolver(defs map[string]Node) *SharedNodeResolver
NewSharedNodeResolver creates a resolver with the given definitions
func (*SharedNodeResolver) VisitNodeShared ¶
func (r *SharedNodeResolver) VisitNodeShared(node *NodeShared, path []string) (Node, error)
VisitNodeShared resolves shared node references
type SingleStateMetadata ¶
type SingleStateMetadata struct {
Transitions []Transition `yaml:"transitions,omitempty" json:"transitions,omitempty"`
}
type State ¶
type State struct {
Node `yaml:",inline"`
SingleStateMetadata `yaml:",inline"`
}
State represents a state in a state machine A state is a node plus transition information
func (State) MarshalYAML ¶
MarshalYAML customizes encoding so state-only fields (like transitions) are preserved alongside the inline node fields.
type StateMachineData ¶
type StateMap ¶
type StateMap struct {
Initial InitialTransitions `yaml:"initial" validate:"required"` // State selector transitions (string is supported as shorthand)
States map[string]State `yaml:"states"` // Inline the states
}
StateMap represents a state machine configuration
type Transition ¶
type Transition struct {
To string `yaml:"to"`
When cel.CELExpr `yaml:"when,omitempty"` // CEL expression
Payload map[string]interface{} `yaml:"payload,omitempty"`
}
Transition represents a state transition
func (Transition) JSONSchema ¶
func (Transition) JSONSchema() *jsonschema.Schema
func (*Transition) UnmarshalYAML ¶
func (t *Transition) UnmarshalYAML(node *yamlv3.Node) error
type WorkerStatus ¶
type WorkerStatus string
WorkerStatus represents the status of a recipe's worker
const ( WorkerStatusRunning WorkerStatus = "running" WorkerStatusStopped WorkerStatus = "stopped" WorkerStatusFailed WorkerStatus = "failed" WorkerStatusStarting WorkerStatus = "starting" )
type WorkflowExecutionInfo ¶
type WorkflowExecutionInfo struct {
JobId string
}
WorkflowExecutionInfo contains job info