Documentation
¶
Index ¶
- func IsLoadError(err error) bool
- func MakeKey(name, version string) string
- func ValidateTemplate(tpl *Template) error
- type Entry
- type ExecutableNode
- type ExecutablePlan
- type LoadError
- type NodeType
- type Registry
- type StrategyType
- type Template
- type TemplateDefaults
- type TemplateEdge
- type TemplateNode
- type TemplateNodeFailure
- type TemplateSummary
- type ValidationError
- type ValidationIssue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLoadError ¶
IsLoadError returns true when err represents aggregated template load failures.
func ValidateTemplate ¶
ValidateTemplate performs structural checks and returns a ValidationError when problems exist.
Types ¶
type Entry ¶
type Entry struct {
Key string
Template *Template
SourcePath string
ContentHash string
LoadedAt time.Time
}
Entry captures a loaded template alongside bookkeeping data.
type ExecutableNode ¶
type ExecutableNode struct {
ID string
Type NodeType
Strategy StrategyType
BudgetMax int
ToolsAllowlist []string
OnFail *TemplateNodeFailure
Metadata map[string]interface{}
DependsOn []string
}
ExecutableNode represents a compiled template node ready for execution.
type ExecutablePlan ¶
type ExecutablePlan struct {
TemplateName string
TemplateVersion string
Defaults TemplateDefaults
Nodes map[string]ExecutableNode
Order []string
Adjacency map[string][]string
Checksum string
}
ExecutablePlan is a deterministic representation of a template ready for workflow execution.
func CompileTemplate ¶
func CompileTemplate(tpl *Template) (*ExecutablePlan, error)
CompileTemplate converts a validated template into an ExecutablePlan.
type LoadError ¶
type LoadError struct {
Failures []string
}
LoadError aggregates template loading failures.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains an in-memory catalogue of templates loaded from disk.
func (*Registry) Finalize ¶
Finalize resolves template inheritance/composition and re-validates the registry.
func (*Registry) Find ¶
Find attempts to locate a template entry by name and optional version. When version is empty, the first matching version (sorted by name/version) is returned.
func (*Registry) List ¶
func (r *Registry) List() []TemplateSummary
List summaries of all currently loaded templates.
func (*Registry) LoadDirectory ¶
LoadDirectory loads every YAML template under the provided directory.
type StrategyType ¶
type StrategyType string
StrategyType enumerates supported execution strategies within templates.
const ( StrategyReact StrategyType = "react" StrategyChainOfThought StrategyType = "chain_of_thought" StrategyTreeOfThoughts StrategyType = "tree_of_thoughts" StrategyDebate StrategyType = "debate" StrategyReflection StrategyType = "reflection" )
type Template ¶
type Template struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Version string `yaml:"version"`
Extends []string `yaml:"extends"`
Defaults TemplateDefaults `yaml:"defaults"`
Nodes []TemplateNode `yaml:"nodes"`
Edges []TemplateEdge `yaml:"edges"`
Metadata map[string]any `yaml:"metadata"`
}
Template captures the raw user-defined workflow structure.
func LoadTemplate ¶
LoadTemplate parses a template from the provided reader.
func LoadTemplateFromFile ¶
LoadTemplateFromFile reads a YAML template from disk.
func (*Template) NodeByID ¶
func (t *Template) NodeByID(id string) *TemplateNode
NodeByID returns a pointer to the node with the supplied ID, if present.
type TemplateDefaults ¶
type TemplateDefaults struct {
ModelTier string `yaml:"model_tier"`
BudgetAgentMax int `yaml:"budget_agent_max"`
RequireApproval *bool `yaml:"require_approval"`
}
TemplateDefaults define shared knobs applied to nodes when individual values are absent.
type TemplateEdge ¶
TemplateEdge expresses an explicit edge in the workflow graph.
type TemplateNode ¶
type TemplateNode struct {
ID string `yaml:"id"`
Type NodeType `yaml:"type"`
Strategy StrategyType `yaml:"strategy"`
DependsOn []string `yaml:"depends_on"`
BudgetMax *int `yaml:"budget_max"`
ToolsAllowlist []string `yaml:"tools_allowlist"`
OnFail *TemplateNodeFailure `yaml:"on_fail"`
Metadata map[string]any `yaml:"metadata"`
}
TemplateNode defines a workflow node within a template.
type TemplateNodeFailure ¶
type TemplateNodeFailure struct {
DegradeTo StrategyType `yaml:"degrade_to"`
Retry int `yaml:"retry"`
EscalateTo NodeType `yaml:"escalate_to"`
}
TemplateNodeFailure specifies backoff behaviour when a node fails.
type TemplateSummary ¶
type TemplateSummary struct {
Name string
Version string
Key string
ContentHash string
SourcePath string
}
TemplateSummary exposes lightweight information about a registered template.
type ValidationError ¶
type ValidationError struct {
Issues []ValidationIssue
}
ValidationError aggregates template validation failures.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error implements the error interface.
func (*ValidationError) HasIssues ¶
func (e *ValidationError) HasIssues() bool
HasIssues reports whether any validation problems were captured.
func (*ValidationError) Messages ¶
func (e *ValidationError) Messages() []string
Messages returns just the human-readable text for each issue.
type ValidationIssue ¶
ValidationIssue captures a single validation failure with a stable code for metrics.