Documentation
¶
Index ¶
- func DefaultEvaluator(ctx context.Context, condition string, input any) (bool, error)
- func DefaultInterpolator(ctx context.Context, templateStr string, data any) (string, error)
- func LegacyInterpolator(ctx context.Context, templateStr string, data any) (string, error)
- type ConditionEvaluator
- type Engine
- type Interpolator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEvaluator ¶ added in v0.3.0
DefaultEvaluator implements the basic "condition: input == 'value'" logic.
func DefaultInterpolator ¶ added in v0.5.0
DefaultInterpolator uses Go's text/template logic.
Types ¶
type ConditionEvaluator ¶ added in v0.3.0
ConditionEvaluator is a function that determines if a transition condition is met.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the core state machine runner.
func NewEngine ¶
func NewEngine(loader ports.GraphLoader, evaluator ConditionEvaluator, interpolator Interpolator) *Engine
NewEngine creates a new engine with dependencies. The engine is immutable after creation. interpolator is optional; if nil, DefaultInterpolator (Standard Go Templates) is used.
func (*Engine) Inspect ¶ added in v0.3.0
Inspect returns a structured view of the entire graph by walking all nodes.
func (*Engine) Navigate ¶ added in v0.3.2
func (e *Engine) Navigate(ctx context.Context, currentState *domain.State, input any) (*domain.State, error)
Navigate determines the next state based on input. Input can be a string (user text) or a domain.ToolResult (side-effect result).
func (*Engine) Render ¶ added in v0.3.2
func (e *Engine) Render(ctx context.Context, currentState *domain.State) ([]domain.ActionRequest, bool, error)
Render calculates the presentation for the current state. It loads the node and generates actions (e.g. print text) but does NOT change state. It returns actions, isTerminal (true if no transitions), and error.