Skip to main content

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)            | `mlua-batteries-sqlite` |
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).  It does not gate SQLite itself:
28//!   the kernel ([`knl`]) keeps every session's event log in a SQLite table —
29//!   the log is read with SQL — so `rusqlite` and `rusqlite-isle` are ordinary
30//!   dependencies and a session is a session in every build.  They are the
31//!   same versions `mlua-batteries-sqlite` builds on (rusqlite 0.37 /
32//!   libsqlite3-sys 0.35), which is not a coincidence: `libsqlite3-sys`
33//!   declares `links = "sqlite3"`, so a build graph may hold exactly one of
34//!   it, whichever way the feature is set.
35//! - `mcp-http`: `mcp.connect_http` returns an explicit error when called.
36//!
37//! # Sandbox
38//!
39//! [`sandbox`] installs an optional process-wide execution boundary (Landlock +
40//! seccomp, Linux only): filesystem writes are confined to an allowlist and
41//! io_uring is denied, while reads and executes stay open. It is inherited by
42//! `sh.exec` / `mcp.connect` children, and must be applied before any async
43//! runtime spawns worker threads — see the module docs.
44
45pub mod bridge;
46pub mod bus;
47pub mod embedded;
48pub mod host;
49pub mod knl;
50pub mod sandbox;
51
52pub use agent_block_types::error::{BlockError, BlockResult};
53pub use host::{run, run_capture, BlockConfig, BlockConfigBuilder, HostContext};