Documentation
¶
Index ¶
Constants ¶
const ( // ActionRenderContent requests the host to display content to the user. // Payload: string (the content) ActionRenderContent = "RENDER_CONTENT" // ActionRequestInput requests the host to collect input from the user. // Payload: InputRequest ActionRequestInput = "REQUEST_INPUT" // ActionCallTool requests the host to execute a side-effect (tool). // Payload: ToolCall ActionCallTool = "CALL_TOOL" )
Standard Action Types
const ( // NodeTypeText displays content and continues immediately (soft step). NodeTypeText = "text" // NodeTypeQuestion displays content and halts waiting for input (hard step). // NOTE: Future architecture may merge this with InputType logic. NodeTypeQuestion = "question" // NodeTypeLogic executes internal script/logic (silent step). NodeTypeLogic = "logic" // NodeTypeTool executes an external side-effect (tool). NodeTypeTool = "tool" )
NodeType constants define the control flow behavior.
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 ¶
ActionResponse represents the result of an ActionRequest.
type ExecutionStatus ¶ added in v0.4.0
type ExecutionStatus string
ExecutionStatus defines the current mode of the engine mechanics.
const ( StatusActive ExecutionStatus = "active" // Normal operation StatusWaitingForTool ExecutionStatus = "waiting_for_tool" // Engine is paused, waiting for Host result StatusTerminated ExecutionStatus = "terminated" // Sink state reached )
type InputRequest ¶ added in v0.3.2
type InputRequest struct {
Type InputType `json:"type"`
Options []string `json:"options,omitempty"`
Default string `json:"default,omitempty"`
}
InputRequest describes the constraints and type of input needed.
type InputType ¶ added in v0.3.2
type InputType string
InputType defines the kind of input requested.
type Node ¶
type Node struct {
ID string `json:"id"`
Type string `json:"type"` // e.g., "text", "question", "logic", "tool"
// 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 `json:"content"`
// Metadata allows for extensible key-value pairs.
Metadata map[string]string `json:"metadata,omitempty"`
// Transitions defines the possible paths from this node.
Transitions []Transition `json:"transitions"`
// Input Configuration (Optional)
InputType string `json:"input_type,omitempty"`
InputOptions []string `json:"input_options,omitempty"`
InputDefault string `json:"input_default,omitempty"`
// Tool Configuration (Optional, used if Type == "tool")
ToolCall *ToolCall `json:"tool_call,omitempty"`
}
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
// Status indicates if the engine is running, waiting, or done.
Status ExecutionStatus
// PendingToolCall holds the ID of the tool call we are waiting for (if Status == WaitingForTool).
PendingToolCall 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).
// Deprecated: Use Status == StatusTerminated instead. Kept for backward compat.
Terminated bool
}
State represents the current snapshot of the execution.
type Tool ¶ added in v0.4.0
Tool defines metadata about a tool available to the engine. This is used for generating schemas/prompts.
type ToolCall ¶ added in v0.4.0
type ToolCall struct {
ID string `json:"id"` // Unique ID for this specific call (e.g. from LLM or generated)
Name string `json:"name"` // Function name to call
Args map[string]any `json:"args,omitempty"` // Arguments for the function
}
ToolCall represents a request from the Engine to the Host to perform a side-effect. Ideally compatible with OpenAI/MCP tool call schemas.
type ToolResult ¶ added in v0.4.0
type ToolResult struct {
ID string `json:"id"` // Must match the ToolCall.ID
Result any `json:"result,omitempty"`
IsError bool `json:"is_error,omitempty"`
Error string `json:"error,omitempty"`
}
ToolResult represents the output of a side-effect returned by the Host.
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.