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
52
53
54
55
56
//! # zapcode-core
//!
//! A minimal, secure TypeScript interpreter for AI agent code execution.
//!
//! ## Architecture
//!
//! ```text
//! TypeScript source
//! │
//! ▼
//! ┌─────────┐
//! │ parser │ oxc_parser → ZapcodeIR (parser/ir.rs)
//! └────┬────┘
//! ▼
//! ┌──────────┐
//! │ compiler │ ZapcodeIR → stack-based bytecode (compiler/instruction.rs)
//! └────┬─────┘
//! ▼
//! ┌─────────┐
//! │ vm │ Execute bytecode, snapshot at external calls, resume later
//! └────┬────┘
//! ▼
//! VmState::Complete(value) | VmState::Suspended { snapshot }
//! ```
//!
//! ## Key modules
//!
//! - [`parser`] — Walks the oxc AST and emits [`parser::ir::ZapcodeIR`]
//! - [`compiler`] — Lowers IR to [`compiler::instruction::Instruction`] bytecode
//! - [`vm`] — Stack-based VM that executes bytecode; entry point is [`ZapcodeRun`]
//! - [`value`] — Runtime value types ([`Value`], closures, generators)
//! - [`snapshot`] — Serialize/deserialize VM state for suspension and resumption
//! - [`sandbox`] — Resource limits (memory, time, stack depth, allocations)
//! - [`error`] — Error types used across all modules
//!
//! ## Security model
//!
//! The sandbox is enforced at the language level: no filesystem, network, env,
//! `eval`, `import`, or `require`. The only way guest code can interact with the
//! host is through registered external functions that suspend the VM.
pub use ZapcodeError;
pub use ResourceLimits;
pub use ZapcodeSnapshot;
pub use ;
pub use Value;
pub use ;