agent_block_core/lib.rs
1//! agent-block-core — host runtime + Lua stdlib bridge + EventBus.
2//!
3//! Depends on `agent-block-types` (error / obs) and `agent-block-mcp`
4//! (rmcp wrapper). The bin crate `agent-block` is a thin CLI on top.
5//!
6//! # Cargo features
7//!
8//! All three are **on by default**, so the default build (and the
9//! `agent-block` CLI) keeps the full runtime surface. SDK embedders that
10//! only need a subset can opt out with `default-features = false` and
11//! re-enable individual axes:
12//!
13//! | Feature | Enables | Pulls in |
14//! |------------|------------------------------------------------------------------|----------|
15//! | `mesh` | `mesh.*` Lua bridge, relay connect, Ed25519 mesh identity | `agent-mesh-core`, `agent-mesh-sdk` |
16//! | `sqlite` | `sql.*` / `kv.*` / `ts.*` Lua bridges (SQLite-backed) | `rusqlite` (bundled), `mlua-batteries/{sql,kv}` |
17//! | `mcp-http` | `mcp.connect_http` (Streamable HTTP / SSE MCP transport) | `agent-block-mcp/mcp-http` → rmcp HTTP-client transports |
18//!
19//! The stdio MCP transport (`mcp.connect`), `http.*`, `tool.*`, `sh.*`,
20//! `log.*`, `bus.*`, and the embedded StdPkg blocks are always available.
21//!
22//! When a feature is **off**:
23//! - `mesh`: the `mesh.*` bridge is not registered; `BlockConfig::relay_url`
24//! / `secret_key` are accepted but ignored.
25//! - `sqlite`: the `sql.*` / `kv.*` / `ts.*` bridges are not registered;
26//! `BlockConfig::sql_path` / `kv_path` / `ts_path` are accepted but ignored
27//! (fields retained for API stability).
28//! - `mcp-http`: `mcp.connect_http` returns an explicit error when called.
29//!
30//! # Sandbox
31//!
32//! [`sandbox`] installs an optional process-wide execution boundary (Landlock +
33//! seccomp, Linux only): filesystem writes are confined to an allowlist and
34//! io_uring is denied, while reads and executes stay open. It is inherited by
35//! `sh.exec` / `mcp.connect` children, and must be applied before any async
36//! runtime spawns worker threads — see the module docs.
37
38pub mod bridge;
39pub mod bus;
40pub mod host;
41pub mod sandbox;
42
43pub use host::{run, BlockConfig, BlockConfigBuilder, HostContext};