Versions in this module Expand all Collapse all v0 v0.1.0 Jul 19, 2026 Changes in this version + func Encode(v Value) (interface{}, error) + func ValidModuleMode(mode ModuleMode) bool + type BudgetError struct + Err error + Limit int64 + Resource string + func (e *BudgetError) Error() string + func (e *BudgetError) Unwrap() error + type CapabilityFlags uint64 + const CapAll + const CapEnvironment + const CapEnvironmentRead + const CapEnvironmentWrite + const CapFilesystem + const CapFilesystemRead + const CapFilesystemWrite + const CapModuleLoading + const CapSafe + type CompileOption func(*compileOptions) + func WithSourceName(name string) CompileOption + type DialectHandler func(body Value, options Value) ([]Value, error) + type DialectOptions struct + Aliases []string + Block DialectHandler + Capabilities []string + Category string + type Error struct + Col int + Err error + File string + Kind ErrorKind + Line int + Message string + Value interface{} + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + type ErrorKind string + const ErrLex + const ErrParse + const ErrRuntime + const ErrScript + type ExitError struct + Code int + Err error + func (e *ExitError) Error() string + func (e *ExitError) Unwrap() error + type HostCallbackError struct + Err error + Name string + func (e *HostCallbackError) Error() string + func (e *HostCallbackError) Unwrap() error + type HostCallbackPanicError struct + Name string + Value interface{} + func (e *HostCallbackPanicError) Error() string + type HotInstance struct + func (inst *HotInstance) Call(name string, args ...interface{}) ([]interface{}, error) + func (inst *HotInstance) CallContext(ctx context.Context, name string, args ...interface{}) ([]interface{}, error) + func (inst *HotInstance) Generation() uint64 + func (inst *HotInstance) Handle() *ModuleHandle + func (inst *HotInstance) Reload() error + func (inst *HotInstance) ReloadContext(ctx context.Context) error + func (inst *HotInstance) ReloadIfChanged() (ReloadResult, error) + func (inst *HotInstance) ReloadIfChangedContext(ctx context.Context) (ReloadResult, error) + func (inst *HotInstance) VM() *VM + type HotLoader struct + func NewHotLoader(opts ...HotLoaderOption) *HotLoader + func (loader *HotLoader) Handle(path string) (*ModuleHandle, bool) + func (loader *HotLoader) Load(path string) (*ModuleHandle, error) + func (loader *HotLoader) LoadContext(ctx context.Context, path string) (*ModuleHandle, error) + func (loader *HotLoader) LoadInstance(path string) (*HotInstance, error) + func (loader *HotLoader) LoadInstanceContext(ctx context.Context, path string) (*HotInstance, error) + func (loader *HotLoader) Reload(path string) error + func (loader *HotLoader) ReloadContext(ctx context.Context, path string) error + func (loader *HotLoader) ReloadIfChanged(path string) (ReloadResult, error) + func (loader *HotLoader) ReloadIfChangedContext(ctx context.Context, path string) (ReloadResult, error) + type HotLoaderOption func(*HotLoader) + func WithHotLoaderCompileOptions(opts ...CompileOption) HotLoaderOption + func WithHotLoaderVMOptions(opts ...Option) HotLoaderOption + type Kind string + const KindBool + const KindChannel + const KindCoroutine + const KindFloat + const KindFunction + const KindInt + const KindNil + const KindString + const KindTable + const KindUnknown + type LibFlags uint64 + const LibAll + const LibApp + const LibArray + const LibBase64 + const LibBinary + const LibBit32 + const LibBits + const LibBytes + const LibCSV + const LibColor + const LibCompress + const LibContainer + const LibControl + const LibCoroutine + const LibCrypto + const LibDB + const LibDebug + const LibDialect + const LibEncoding + const LibFS + const LibGame + const LibHTTP + const LibHash + const LibIO + const LibJSON + const LibLLM + const LibLinalg + const LibLog + const LibMath + const LibMatrix + const LibNet + const LibODE + const LibOS + const LibPath + const LibProcess + const LibRand + const LibRegexp + const LibSafe + const LibScript + const LibSoA + const LibSort + const LibStats + const LibString + const LibTable + const LibTestkit + const LibTime + const LibURL + const LibUTF8 + const LibUUID + const LibVec + type Module map[string]interface + func ModuleFrom(source interface{}, opts ...ModuleFromOption) (Module, error) + type ModuleFromOption func(*moduleFromOptions) + func WithModuleExactNames() ModuleFromOption + func WithModuleNameMapper(mapper func(string) string) ModuleFromOption + type ModuleHandle struct + func (handle *ModuleHandle) Call(vm *VM, name string, args ...interface{}) ([]interface{}, error) + func (handle *ModuleHandle) CallContext(ctx context.Context, vm *VM, name string, args ...interface{}) ([]interface{}, error) + func (handle *ModuleHandle) Generation() uint64 + func (handle *ModuleHandle) Path() string + func (handle *ModuleHandle) Program() (*Program, bool) + func (handle *ModuleHandle) Run(vm *VM) error + func (handle *ModuleHandle) RunContext(ctx context.Context, vm *VM) error + type ModuleMode string + const ModuleModeMod + const ModuleModeReadonly + const ModuleModeVendor + type Option func(*vmOptions) + func ModuleOptionsForScript(script string) []Option + func ModuleOptionsForScriptMode(script string, mode ModuleMode) []Option + func SecuritySandbox() Option + func WithArgs(script string, args ...string) Option + func WithCapabilities(caps CapabilityFlags) Option + func WithDebugAccess(enabled bool) Option + func WithDialect(name string, handler DialectHandler, opts ...DialectOptions) Option + func WithDynamicEval(enabled bool) Option + func WithEnvironment(enabled bool) Option + func WithEnvironmentAllowlist(names ...string) Option + func WithEnvironmentRead(enabled bool) Option + func WithEnvironmentWrite(enabled bool) Option + func WithFilesystem(enabled bool) Option + func WithFilesystemRead(enabled bool) Option + func WithFilesystemRoot(root string) Option + func WithFilesystemWrite(enabled bool) Option + func WithGoImports(imports map[string]any) Option + func WithJIT() Option + func WithLLMProvider(provider llm.Provider) Option + func WithLLMProviderFactory(factory llm.ProviderFactory) Option + func WithLLMRecorder(sink llm.RecordSink) Option + func WithLLMReplay(records []llm.Record) Option + func WithLLMTrace(sink llm.TraceSink) Option + func WithLibs(libs LibFlags) Option + func WithMaxCallDepth(max int64) Option + func WithMaxChannelCapacity(max int64) Option + func WithMaxFilesystemReadBytes(max int64) Option + func WithMaxFilesystemWriteBytes(max int64) Option + func WithMaxGoroutines(max int64) Option + func WithMaxHostResultBytes(max int64) Option + func WithMaxModuleBytes(max int64) Option + func WithMaxModuleDepth(max int64) Option + func WithMaxNativeCalls(max int64) Option + func WithMaxSteps(max int64) Option + func WithModuleCache(root string) Option + func WithModuleCollection(name, root string) Option + func WithModuleLoading(enabled bool) Option + func WithModuleMode(mode ModuleMode) Option + func WithModuleReplace(path, root string) Option + func WithNetworkAccess(enabled bool) Option + func WithPrint(fn func(args ...interface{})) Option + func WithProcessExecution(enabled bool) Option + func WithProcessShell(enabled bool) Option + func WithRequirePath(path string) Option + func WithSandbox() Option + func WithSecurity(policy SecurityPolicy) Option + func WithTestkitAccess(enabled bool) Option + func WithTracing() Option + func WithVM() Option + type Pool struct + func NewPool(max int, init func() *VM) *Pool + func NewPoolWithReset(max int, init func() *VM, reset PoolResetFunc) *Pool + func (p *Pool) Do(fn func(*VM) error) error + func (p *Pool) Get() *VM + func (p *Pool) Put(vm *VM) + func (p *Pool) Size() int + type PoolResetFunc func(*VM) bool + type Program struct + func Compile(src string, opts ...CompileOption) (*Program, error) + func CompileContext(ctx context.Context, src string, opts ...CompileOption) (*Program, error) + func CompileFile(path string, opts ...CompileOption) (*Program, error) + func CompileFileContext(ctx context.Context, path string, opts ...CompileOption) (*Program, error) + func (p *Program) SourceName() string + type ReloadResult struct + Changed bool + Generation uint64 + type SecurityPolicy struct + Capabilities CapabilityFlags + CapabilitiesSet bool + DisableDebugAccess bool + DisableDynamicEval bool + DisableJIT bool + DisableModuleLoading bool + DisableNetworkAccess bool + DisableProcessExecution bool + DisableProcessShell bool + DisableTestkitAccess bool + EnvironmentAllowlist []string + Libs LibFlags + MaxCallDepth int64 + MaxChannelCapacity int64 + MaxFilesystemReadBytes int64 + MaxFilesystemWriteBytes int64 + MaxGoroutines int64 + MaxHostResultBytes int64 + MaxModuleBytes int64 + MaxModuleDepth int64 + MaxNativeCalls int64 + MaxSteps int64 + type VM struct + func New(opts ...Option) *VM + func (vm *VM) BindMethod(className, methodName string, fn interface{}) error + func (vm *VM) BindStruct(name string, proto interface{}) error + func (vm *VM) BindStructWithConstructor(name string, proto interface{}, ctor interface{}) error + func (vm *VM) Call(name string, args ...interface{}) ([]interface{}, error) + func (vm *VM) CallContext(ctx context.Context, name string, args ...interface{}) ([]interface{}, error) + func (vm *VM) CallPublicValue(fn Value, args ...Value) ([]Value, error) + func (vm *VM) CallValue(fn interface{}, args ...interface{}) ([]interface{}, error) + func (vm *VM) CallValueContext(ctx context.Context, fn interface{}, args ...interface{}) ([]interface{}, error) + func (vm *VM) Exec(src string) error + func (vm *VM) ExecContext(ctx context.Context, src string) error + func (vm *VM) ExecFile(path string) error + func (vm *VM) ExecFileContext(ctx context.Context, path string) error + func (vm *VM) Get(name string) (interface{}, error) + func (vm *VM) GetPublicValue(name string) Value + func (vm *VM) RegisterFunc(name string, fn interface{}) error + func (vm *VM) RegisterModule(name string, members Module) error + func (vm *VM) RegisterModuleFrom(name string, source interface{}, opts ...ModuleFromOption) error + func (vm *VM) RegisterTable(name string, members map[string]interface{}) error + func (vm *VM) Reset() + func (vm *VM) Run(prog *Program) error + func (vm *VM) RunContext(ctx context.Context, prog *Program) error + func (vm *VM) Set(name string, val interface{}) error + func (vm *VM) SetArgs(script string, args []string) + func (vm *VM) SetPublicValue(name string, val Value) + type Value struct + func Bool(v bool) Value + func Decode(v interface{}) (Value, error) + func Float(v float64) Value + func Int(v int64) Value + func MustDecode(v interface{}) Value + func Nil() Value + func String(v string) Value + func (v *Value) Decode(src interface{}) error + func (v Value) Bool() bool + func (v Value) Encode() (interface{}, error) + func (v Value) Float() float64 + func (v Value) Int() int64 + func (v Value) IsNil() bool + func (v Value) Kind() Kind + func (v Value) String() string + func (v Value) To(target reflect.Type) (reflect.Value, error)