mimobox_sdk/lib.rs
1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![warn(missing_docs)]
3//! mimobox-sdk: Unified Agent Sandbox API
4//!
5//! **Smart routing by default, full control for advanced users.**
6//!
7//! Zero-config sandbox creation with automatic backend selection, plus
8//! complete configuration control via [`Config::builder()`].
9//!
10//! # Quick Start
11//!
12//! ```rust,no_run
13//! use mimobox_sdk::Sandbox;
14//!
15//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
16//! let mut sandbox = Sandbox::new()?;
17//! let result = sandbox.execute("/bin/echo hello")?;
18//! println!("exit: {:?}", result.exit_code);
19//! sandbox.destroy()?;
20//! # Ok(())
21//! # }
22//! ```
23//!
24//! # Feature Gates
25//!
26//! | Feature | Backend | Default |
27//! |---------|---------|---------|
28//! | `os` | OS-level (Linux/macOS) | Yes |
29//! | `vm` | microVM (Linux + KVM) | No |
30//! | `wasm` | Wasm (Wasmtime) | No |
31//!
32//! # Key Types
33//!
34//! - [`Sandbox`] — Primary entry point for all sandbox operations
35//! - [`Config`] / [`ConfigBuilder`] — SDK configuration with builder pattern
36//! - [`ExecuteResult`] — Command execution result (stdout, stderr, exit code, timing)
37//! - [`StreamEvent`] — Streaming output event enum
38//! - [`SdkError`] / [`ErrorCode`] — Structured error model
39//! - [`SandboxSnapshot`] — Opaque snapshot handle
40//! - [`PtySession`] — Interactive terminal session
41
42mod config;
43mod dispatch;
44mod error;
45mod router;
46mod sandbox;
47mod types;
48mod vm_helpers;
49
50pub use config::{Config, ConfigBuilder, IsolationLevel, NetworkPolicy, TrustLevel};
51pub use error::SdkError;
52pub use mimobox_core::{DirEntry, ErrorCode, FileStat, FileType, PtyConfig, PtyEvent, PtySize};
53pub use sandbox::Sandbox;
54pub use types::{ExecuteResult, HttpResponse, PtySession, SandboxSnapshot, StreamEvent};
55#[cfg(all(feature = "vm", target_os = "linux"))]
56pub use types::{RestorePool, RestorePoolConfig};