runtime

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEvaluator added in v0.3.0

func DefaultEvaluator(ctx context.Context, condition string, input any) (bool, error)

DefaultEvaluator implements the basic "condition: input == 'value'" logic.

func DefaultInterpolator added in v0.5.0

func DefaultInterpolator(ctx context.Context, templateStr string, data any) (string, error)

DefaultInterpolator uses Go's text/template logic.

func LegacyInterpolator added in v0.5.0

func LegacyInterpolator(ctx context.Context, templateStr string, data any) (string, error)

LegacyInterpolator implements the simple "strings.ReplaceAll" logic for backward compatibility.

Types

type ConditionEvaluator added in v0.3.0

type ConditionEvaluator func(ctx context.Context, condition string, input any) (bool, error)

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

func (e *Engine) Inspect() ([]domain.Node, error)

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.

type Interpolator added in v0.5.0

type Interpolator func(ctx context.Context, templateStr string, data any) (string, error)

Interpolator is a function that replaces variables in a string with values from data.

Jump to

Keyboard shortcuts

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