MobKitConfig. The runtime resolves
each discovered module, selects its process boundary, records startup health,
and exposes module operations through UnifiedRuntime.
Route a module call
Use the host-facingUnifiedRuntime::route_module_call method. A request names
the configured module, the method or MCP tool, and its JSON parameters:
- Verifies that
module_idis loaded - Resolves the matching
ModuleConfigand optionalPreSpawnData - Selects the MCP boundary when the pre-spawn environment contains
MOBKIT_MODULE_BOUNDARY=mcp - Returns
ModuleRouteResponse { module_id, method, payload }
MCP boundary
Mark a module as MCP through its pre-spawn environment:request.method with request.params, and closes the
connection. The caller-provided timeout bounds connect, list, call, and close
operations.
The core module IDs router, delivery, and memory require MCP. Routing one
of those IDs without the MCP marker fails with
ModuleRouteError::ModuleRuntime(RuntimeBoundaryError::Mcp(McpBoundaryError::McpRequired { .. })).
There is no event-line fallback for those core flows.
Event-line boundary
A module without the MCP marker uses the event-line boundary. The process must write a JSON event as its first stdout line. For example:EventEnvelope<UnifiedEvent>. On this
boundary, route_module_call launches the module and returns the first
normalized module event’s payload field as ModuleRouteResponse.payload. It
does not include the event envelope metadata or the normalized event’s module
and event_type fields in that payload. It also does not write
request.method or request.params to the module’s stdin. Use MCP when the
subprocess needs a request/response tool-call contract.
For a discovered one-shot module that emits one event and exits, use the public
configuration-aware helper:
PreSpawnData, executes it once, and returns the normalized event.
Startup health
The module supervisor records startup transitions. Read them through the unified runtime:ModuleHealthTransition has four fields:
ModuleHealthState has exactly these variants:
Restart policies
For event-line modules, restart behavior is bounded byRuntimeOptions:
MCP startup probes the configured tool server once. It records
Starting -> Healthy on success or Starting -> Failed -> Stopped on failure;
the event-line restart budgets are not applied to that probe.
