Skip to main content

Module runtime

Module runtime 

Source
Expand description

Runtime handles the MCP server may optionally receive from the main daemon.

The standalone MCP binary (now removed) had to boot blind: it only knew the workspace dir and a best-effort Config. Tools that depend on live runtime state — a delegate agent pool, the channel map, a workspace manager, a session store, a concrete provider — were silently skipped.

Now that the MCP server runs as an in-process tokio task inside the main daemon, the gateway can hand those handles down via RuntimeHandles and the registry can register the previously-skipped tools.

§Design rules

  • Every field is Option<Arc<_>> so missing handles degrade gracefully — the tool is listed in skipped with a reason, never a panic.
  • We deliberately do not import gateway::AppState here. That would create a module-layer cycle (gateway → mcp_server → gateway). Callers clone the Arcs they need out of AppState and pass them individually.
  • Types come from the modules that own them, not from some central bag. If a caller wants to wire up discord_search, they pass the Arc<dyn Memory> backing discord.db directly — same shape the gateway uses.

Structs§

RuntimeHandles
Aggregates Arc-clones of everything the previously-skipped MCP tools need.