session_core/session_stats/external_root.rs
1//! The counters of a session whose root agent lives outside Ultron: Claude Code calling `rlm` over MCP
2//! (session-worker.ts `new SessionStatsRecorder({ root: external === undefined ? "lane" : "external" })`).
3
4use super::SessionStats;
5use jsrt::sync;
6use serde_json::json;
7
8impl SessionStats {
9 /// Count this session as one whose root is `root` (`external` for Claude Code). Called before
10 /// [`SessionStats::attach`], it is the root the stored document takes; nothing is saved until a counter changes.
11 pub fn set_root(&self, root: &str) {
12 sync::lock(&self.shared.state).document["root"] = json!(root);
13 }
14}