merry_runtime/
tool_catalog.rs1use crate::{FileSessionStore, RuntimeError, session::SessionState};
2use merry_core::SessionId;
3
4pub struct LoadedSession {
10 state: SessionState,
11}
12
13impl LoadedSession {
14 pub async fn load(
16 store: &FileSessionStore,
17 session_id: &SessionId,
18 ) -> Result<Self, RuntimeError> {
19 Ok(Self {
20 state: SessionState::load_from(store, session_id).await?,
21 })
22 }
23
24 pub(crate) fn into_state(self) -> SessionState {
25 self.state
26 }
27
28 pub(crate) fn transcript_items(&self) -> Vec<crate::SessionTranscriptItem> {
29 self.state
30 .full_transcript_snapshot()
31 .into_iter()
32 .map(crate::SessionTranscriptItem::from)
33 .collect()
34 }
35}