Expand description
Shared Lua 5.4 VM runtime for connectors and tools.
Provides a sandboxed Lua environment with host APIs that both
crate::connector_script and crate::tool_script use. The Lua VM
runs on a blocking thread (via [tokio::task::spawn_blocking]), so all
host functions use synchronous I/O (reqwest::blocking, std::thread::sleep).
ยงHost APIs
| Module | Functions |
|---|---|
http | get, post, put |
json | parse, encode |
env | get |
log | info, warn, error, debug |
fs | read, list (sandboxed to script directory) |
base64 | encode, decode |
crypto | sha256, hmac_sha256 |
sleep | sleep(seconds) |
ยงSandboxing
Dangerous Lua standard libraries (os, io, debug, loadfile, dofile)
are removed. Filesystem access is restricted to a configurable sandbox root
directory.
Functionsยง
- do_
http_ ๐request - Execute an HTTP request and return a Lua table with the response.
- expand_
env_ ๐vars - Expand
${VAR_NAME}patterns in a string from the process environment. - json_
value_ ๐to_ lua - Convert a JSON value to a Lua value.
- lua_
value_ ๐to_ json - Convert a Lua value to a JSON value.
- register_
all_ ๐host_ apis - Register all standard host APIs on a Lua VM instance.
- register_
base64_ ๐api - register_
crypto_ ๐api - register_
env_ ๐api - register_
fs_ ๐api - register_
http_ ๐api - register_
json_ ๐api - register_
log_ ๐api - register_
sleep ๐ - sandbox_
globals ๐ - Remove dangerous standard library functions from the Lua globals.
- toml_
table_ ๐to_ lua - Convert a TOML table to a Lua table.
- toml_
value_ ๐to_ lua - Convert a TOML value to a Lua value, expanding
${VAR}in strings.