Expand description
The shared-world daemon: hosts one ECS world for every agent and serves the
control socket. This module holds the CLI-side pieces that plug into the
runtime’s daemon library (leviath_runtime::host,
leviath_runtime::control_socket): the tool service that bridges tool calls
to the built-in / MCP executors and the interaction hub.
Modules§
- client
- Client-side helpers for talking to the shared-world daemon: building a spawn
request from local inputs and exchanging it over the control socket. Shared by
lev run(and reusable by other clients). The socket-path resolution + connect live in the binary; these cores are unit-testable against a fake socket server. - config_
reload - Hot-reloading of the daemon’s spawn-time config.
- fanout_
spawner - The daemon-side
FanOutSpawner: resolves a fan-out worker’s blueprint (self-at-worker-stage / a named agent / a capability query) and starts it in the shared world, seeded with its work item. - gate_
rules - Scripted taint-gate rules: load
~/.config/leviath/rules/*.rhaiand build theScriptRuleCheckerthe runtime’s taint gate consults after the static allowlist. The daemon owns the Rhai engine (leviath-runtime has no scripting dependency), so the checker is installed as a world resource. - mcp_
pool - The shared, lazily-connected MCP pool.
- recovery
- Restart recovery: reload persisted non-terminal agents into a fresh world when
the daemon starts, so runs interrupted by a stop/crash resume where they left
off - critically, any agent that was mid-inference re-issues that inference
(the reloaded agent is
ReadyToInfer), rather than being lost. - sandbox_
manager - Per-agent sandbox lifecycle and shell-command routing.
- script_
host - The daemon’s real
ScriptHostfor Rhai script tools (permission Layer 3). - seed_
command - Execution of
seed = { command = "..." }region seeds. - setup
- Daemon assembly: build a fully-wired
WorldHost(world + tool service + interaction hub + the blueprint spawner) ready to be driven byWorldHost::serve. The async setup (provider registry, MCP connections) happens in the binary and is passed in; this wiring is synchronous and testable - spawning an agent through the installed spawner exercises the whole path. - spawn
- The daemon spawner: turns a
SpawnArgsrequest into a live agent in the shared world - the CLI-side policy the runtime host calls for aSpawncontrol op. - subagent
- Sub-agent tool handlers: turn
spawn_agent/check_agent/wait_for_agent/send_to_agent/kill_agenttool calls intoSubAgentOps serviced by the host (which owns the world + spawner). The tool lane runs off the world, so it blocks on the host applying each op via a oneshot - the same shape as an interaction. - tool_
service - The real
ToolServicefor the shared world: bridges an agent’s tool calls to the built-in and MCP executors, applying the same policy / approval / interaction flow the imperative worker used - but with interactions routed through the in-memoryleviath_runtime::interaction_hubinstead of file polling.