scriptnode

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnv

func BuildEnv(ctx context.Context, config map[string]any, fns ...BindingFunc) *script.Env

BuildEnv creates a script.Env from binding funcs evaluated against ctx.

Types

type BindingFunc

type BindingFunc func(ctx context.Context) (name string, value any)

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.

Jump to

Keyboard shortcuts

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