1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A sandboxed Lua runtime for LLM tool use.
//!
//! onetool embeds Lua 5.4 and restricts dangerous operations (file I/O, code loading,
//! OS commands, metatable manipulation, coroutines) while preserving safe functionality
//! (string, table, math, utf8, os.time, os.date).
//!
//! # Quick Start
//!
//! ```
//! use onetool::Repl;
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let repl = Repl::new()?;
//!
//! let outcome = repl.eval("return 1 + 1")?;
//!
//! match outcome.result {
//! Ok(values) => println!("Result: {:?}", values),
//! Err(error) => println!("Error: {}", error),
//! }
//!
//! for line in outcome.output {
//! print!("{}", line);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! # Security
//!
//! The sandboxed runtime blocks file I/O, network access, code loading, and OS command
//! execution. Dangerous Lua globals are set to `nil`, causing attempts to use them to fail
//! with "attempt to call a nil value" errors. See [`runtime::sandbox`] for details.
//!
//! # Key Modules
//!
//! - [`Repl`]: Main interface for evaluating Lua code
//! - [`runtime`]: Runtime creation and sandboxing
//! - [`tool_definition`]: Tool schema for LLM integration
// -- Flatten
pub use Repl;
// -- Public modules