Documentation
¶
Index ¶
- func BuildEnv(ctx context.Context, config map[string]any, fns ...BindingFunc) *script.Env
- type BindingFunc
- func NewBoardBridge(board *graph.Board) BindingFunc
- func NewExprBridge() BindingFunc
- func NewFSBridge(ws workspace.Workspace) BindingFunc
- func NewShellBridge(runner workspace.CommandRunner, opts ...ShellBridgeOption) BindingFunc
- func NewStreamBridge(stream graph.StreamCallback, nodeID string) BindingFunc
- type ScriptNode
- func (n *ScriptNode) Config() map[string]any
- func (n *ScriptNode) ExecuteBoard(ctx graph.ExecutionContext, board *graph.Board) error
- func (n *ScriptNode) ID() string
- func (n *ScriptNode) InputPorts() []graph.Port
- func (n *ScriptNode) OutputPorts() []graph.Port
- func (n *ScriptNode) SetConfig(c map[string]any)
- func (n *ScriptNode) Type() string
- type ShellBridgeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BindingFunc ¶
BindingFunc creates a named binding for script execution. The returned name becomes the global variable name in the script scope, and the value is typically a map[string]any of callable Go functions.
func NewBoardBridge ¶
func NewBoardBridge(board *graph.Board) BindingFunc
func NewExprBridge ¶
func NewExprBridge() BindingFunc
func NewFSBridge ¶
func NewFSBridge(ws workspace.Workspace) BindingFunc
NewFSBridge creates a binding that exposes file read/write operations to scripts.
func NewShellBridge ¶
func NewShellBridge(runner workspace.CommandRunner, opts ...ShellBridgeOption) BindingFunc
NewShellBridge creates a binding that exposes shell command execution to scripts.
func NewStreamBridge ¶
func NewStreamBridge(stream graph.StreamCallback, nodeID string) BindingFunc
type ScriptNode ¶
type ScriptNode struct {
// contains filtered or unexported fields
}
ScriptNode is a script-based graph node that delegates execution to a language-agnostic script.Runtime.
func New ¶
func New(id, nodeType, scriptSrc string, config map[string]any, rt script.Runtime, extras ...BindingFunc) *ScriptNode
New creates a ScriptNode with the given script and configuration.
func (*ScriptNode) Config ¶
func (n *ScriptNode) Config() map[string]any
func (*ScriptNode) ExecuteBoard ¶
func (n *ScriptNode) ExecuteBoard(ctx graph.ExecutionContext, board *graph.Board) error
ExecuteBoard runs the script with board, expr, stream, and runtime bindings.
func (*ScriptNode) ID ¶
func (n *ScriptNode) ID() string
func (*ScriptNode) InputPorts ¶
func (n *ScriptNode) InputPorts() []graph.Port
func (*ScriptNode) OutputPorts ¶
func (n *ScriptNode) OutputPorts() []graph.Port
func (*ScriptNode) SetConfig ¶
func (n *ScriptNode) SetConfig(c map[string]any)
func (*ScriptNode) Type ¶
func (n *ScriptNode) Type() string
type ShellBridgeOption ¶
type ShellBridgeOption func(*shellBridgeConfig)
ShellBridgeOption configures a shell bridge.
func WithAllowedCommands ¶
func WithAllowedCommands(cmds ...string) ShellBridgeOption
WithAllowedCommands restricts the shell bridge to only execute the specified commands. When set, any command not in the list is rejected.