Skip to main content

Module host

Module host 

Source
Expand description

Host — the thin Rust shell that wires up Lua VM, Mesh, HTTP, and MCP.

§Responsibilities

  1. Spawn an mlua-isle AsyncIsle (dedicated Lua VM thread with coroutine support)
  2. Optionally connect to agent-mesh relay
  3. Initialize the MCP manager for stdio-based MCP server connections
  4. Inject all Lua stdlib bridges (mesh.*, http.*, sh.*, tool.*, log.*, mcp.*)
  5. Execute the user-provided Lua script via coroutine_eval (async-aware)
  6. Graceful shutdown (Isle + MCP servers + mesh)

Structs§

BlockConfig
HostContext
Shared context passed into Lua bridge functions.
HostToolSpec
Declarative spec for a Rust-implemented tool injected into the Lua tool registry before the user script runs. The resulting entry is indistinguishable from a Lua-defined tool from the script’s view: tool.call("<name>", input), agent.run({ ... }) tool dispatch, and tool.schema() enumeration all work uniformly.
ToolMeta
Snapshot of a tool that a given BlockConfig will (statically) expose to the LLM. Produced by inspect_tools without running the script. MCP server tools are not included because they are only known after the MCP initialize handshake completes; callers that need that view should run the script and call tool.schema() from Lua.

Enums§

PromptSource
How a string payload (prompt / system context) is supplied.
ScriptSource
How the Lua script source for run() is supplied.
SecretKeySource
How the Ed25519 mesh identity secret key is supplied.
ToolSource
Origin of a tool listed by inspect_tools.

Traits§

ToolHandler
Async handler invoked when the LLM (or a Lua call to tool.call(name, ...)) targets a Rust-implemented tool supplied via BlockConfig::host_tools.

Functions§

inspect_tools
Inspect the tools a BlockConfig will expose to the LLM without actually running the script. Returns the merged list of host_tools (declared in the config) and embedded-block sources.
run