domain

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ActionRenderContent requests the host to display content to the user.
	// Payload: string (the content)
	ActionRenderContent = "RENDER_CONTENT"
)

Standard Action Types

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRequest

type ActionRequest struct {
	Type    string // e.g., "CLI_PRINT", "HTTP_GET"
	Payload any    // The data needed to perform the action
}

ActionRequest represents a side-effect that the engine requests the host to perform.

type ActionResponse

type ActionResponse struct {
	Success bool
	Data    any
	Error   error
}

ActionResponse represents the result of an ActionRequest.

type Node

type Node struct {
	ID   string
	Type string // e.g., "text", "question", "logic"

	// Content holds the raw data for this node.
	// For a text node, it might be the markdown content.
	// For a logic node, it might be the script or parameters.
	Content []byte

	// Metadata allows for extensible key-value pairs.
	Metadata map[string]string

	// Transitions defines the possible paths from this node.
	Transitions []Transition
}

Node represents a logical unit in the graph. It can contain text content (for Wiki-style) or logic instructions (for Logic-style).

type State

type State struct {
	// CurrentNodeID is the identifier of the active node.
	CurrentNodeID string

	// Memory holds variable state for the session.
	Memory map[string]any

	// History could track the path taken (optional for now, but good for debugging)
	History []string

	// Terminated indicates if the execution has reached a sink state (no transitions).
	Terminated bool
}

State represents the current snapshot of the execution.

func NewState

func NewState(startNodeID string) *State

NewState creates a clean state starting at a specific node.

type Transition

type Transition struct {
	FromNodeID string `json:"from_node_id,omitempty"`
	ToNodeID   string `json:"to_node_id"`

	// Condition is a simple expression string that must evaluate to true
	// for this transition to be valid. e.g., "user_age >= 18"
	// If empty, it's considered an "always" transition (default).
	Condition string `json:"condition,omitempty"`
}

Transition defines a rule to move from one node to another.

Jump to

Keyboard shortcuts

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