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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Lua Stdlib Bridge — injects all `*.*` global APIs into the Lua VM.
//!
//! Each submodule registers one namespace:
//!
//! | Module | Lua namespace | Purpose |
//! |--------|--------------|---------|
//! | `mesh` | `mesh.*` | Agent-to-agent mesh communication |
//! | `mcp` | `mcp.*` | MCP server management |
//! | `sh` | `sh.*` | Shell command execution |
//! | `tool` | `tool.*` | Tool registry (define and call tools from Lua) |
//! | `http` | `http.*` | Async HTTP client |
//! | `log` | `log.*`, `env.*` | Logging and environment access |
//! | `ts` | `std.ts.*` | SQLite-backed time-series primitive (in-tree) |
use *;
use crateHostContext;
// Re-export `obs` from agent-block-types so that existing
// `crate::bridge::obs::*` paths inside core keep compiling without
// duplicating the module body.
pub use obs;
// Re-export the Lua ↔ JSON converters from agent-block-mcp. They live in
// the MCP crate because the rmcp handler depends on them; core only needs
// to forward `lua_to_json` / `json_to_lua` for the in-process bridges
// (llm / mesh / mcp.lua) that historically reached `crate::bridge::*`.
pub use ;
/// Register bridge APIs shared between main VM and handler VM.
///
/// Registers everything except `bus::*`. Split out from `register_all` so
/// the handler-side Isle can re-use the same set of bridges without
/// installing the main-VM-only `bus` global.
///
/// `is_handler_side` is forwarded to `mesh::register` so the handler Isle
/// can skip the `mesh.on` alias (which depends on `bus.on` and would fail
/// because the handler Isle does not expose a `bus` global).
/// Register all bridge APIs into the Lua state (main Isle).
///
/// Note: `fs`, `env`, `json`, `path`, `time` are provided by mlua-batteries
/// (registered as `std.*` in host.rs). This function registers only
/// agent-block-specific APIs.
/// Register bridge APIs for the handler Isle.
///
/// The handler Isle runs Lua handlers forwarded from the main Isle's
/// `bus.on` / `bus.on_any` via bytecode transfer. It therefore needs the
/// dispatcher-side globals (`__bus_handlers`, `__bus_on_any`,
/// `__bus_dispatch`) installed by
/// [`bus::install_bus_dispatcher_on_handler_isle`], but does **not** expose
/// the `bus.*` Lua table — nested `bus.on(...)` from inside a handler is
/// intentionally unsupported.