pub struct DefaultHandler {
pub sink: Box<dyn IoSink>,
pub read_root: Option<PathBuf>,
pub budget_used: RefCell<u64>,
pub program: Option<Arc<Program>>,
pub chat_registry: Option<Arc<ChatRegistry>>,
pub mcp_clients: McpClientCache,
/* private fields */
}Fields§
§sink: Box<dyn IoSink>§read_root: Option<PathBuf>Optional read root for io.read — when set, io.read("p") resolves
to read_root.join(p). Lets tests run without touching the real fs.
budget_used: RefCell<u64>Captured budget consumption (post-static-check, observability only).
program: Option<Arc<Program>>Shared reference to the program, needed by net.serve so the
handler can spin up fresh VMs to dispatch incoming requests.
None if the handler was constructed without a program.
chat_registry: Option<Arc<ChatRegistry>>Chat registry; populated by net.serve_ws’s per-message
dispatch so chat.broadcast / chat.send work from inside
a handler invocation.
mcp_clients: McpClientCacheLRU cache of agent.call_mcp clients keyed by the
command-line string (#197). Avoids spawn-per-call cost
when an agent invokes the same MCP server in tight loops.
Capped — when the cache is full, the least-recently-used
entry is dropped (its subprocess is reaped on Drop).