MCPcopy Create free account
hub / github.com/AI45Lab/Code / load_session_data

Function load_session_data

core/src/agent_api/session_persistence.rs:134–151  ·  view source on GitHub ↗
(
    store: &Arc<dyn SessionStore>,
    session_id: &str,
)

Source from the content-addressed store, hash-verified

132}
133
134pub(super) fn load_session_data(
135 store: &Arc<dyn SessionStore>,
136 session_id: &str,
137) -> Result<SessionData> {
138 let data = match tokio::runtime::Handle::try_current() {
139 Ok(handle) => tokio::task::block_in_place(|| handle.block_on(store.load(session_id)))
140 .map_err(|e| {
141 CodeError::Session(format!("Failed to load session {}: {}", session_id, e))
142 })?,
143 Err(_) => {
144 return Err(CodeError::Session(
145 "No async runtime available for session resume".to_string(),
146 ))
147 }
148 };
149
150 data.ok_or_else(|| CodeError::Session(format!("Session not found: {}", session_id)))
151}
152
153pub(super) fn apply_persisted_runtime_options(
154 mut opts: SessionOptions,

Callers 1

resume_sessionFunction · 0.85

Calls 3

block_onMethod · 0.80
SessionClass · 0.50
loadMethod · 0.45

Tested by

no test coverage detected