script

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package script defines a language-agnostic script execution interface. Implementations (e.g. script/jsrt for JavaScript, script/luart for Lua) provide concrete runtimes that satisfy the Runtime interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// Config is script-level configuration, accessible as a global in the script.
	Config map[string]any

	// Bindings maps names to host objects injected into the script's global scope.
	// Each value is typically a map[string]any of Go functions callable from the script.
	Bindings map[string]any
}

Env carries per-execution configuration and host bindings.

type Runtime

type Runtime interface {
	Exec(ctx context.Context, name, source string, env *Env) (*Signal, error)
}

Runtime executes scripts with injected host bindings. Implementations must be safe for concurrent use.

type Signal

type Signal struct {
	Type    string `json:"type"`
	Message string `json:"message,omitempty"`
}

Signal represents a control signal from a script back to the host.

Directories

Path Synopsis
Package jsrt provides a goja-based JavaScript implementation of script.Runtime.
Package jsrt provides a goja-based JavaScript implementation of script.Runtime.

Jump to

Keyboard shortcuts

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