builtins

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 50 Imported by: 7

Documentation

Overview

Package builtins contains the extracted builtin function implementations for the interpreter. Each file registers its builtins via eval.RegisterBuiltins in an init() function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NativeOSModule

func NativeOSModule() map[string]object.Object

NativeOSModule returns the import-only native/os module exports.

func ParseJSONToObject

func ParseJSONToObject(input string) (object.Object, error)

func SanitizePathLocal

func SanitizePathLocal(userPath string) (string, error)

SanitizePathLocal resolves user-supplied paths to absolute paths and ensures they remain within the allowed filesystem root. The root is determined by:

  1. The active sandbox base directory (sandbox.ActiveSandboxBaseDir()), if set
  2. The current working directory, as a fallback

This prevents interpreter scripts from accessing or modifying files outside the project/sandbox boundary. Symlinks are resolved on both the target path and the root before the jail check, so a symlink inside the allowed root that points outside of it cannot be used to escape the sandbox. If the target path does not exist yet (e.g. write_file creating a new file), symlinks are resolved on the parent directory instead and rejoined with the final path component.

Types

type GeneratorValue

type GeneratorValue struct {
	// contains filtered or unexported fields
}

func (*GeneratorValue) Inspect

func (g *GeneratorValue) Inspect() string

func (*GeneratorValue) Type

func (g *GeneratorValue) Type() object.ObjectType

type NativeCommandRunResult

type NativeCommandRunResult struct {
	Command   string
	Args      []string
	Stdout    string
	Stderr    string
	ExitCode  int
	OK        bool
	TimedOut  bool
	Cancelled bool
	Truncated bool
	Error     string
}

func RunNativeCommandForRepl

func RunNativeCommandForRepl(env *object.Environment, command string, args []string) NativeCommandRunResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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