MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / resolve_active_session

Function resolve_active_session

atomic-cli/src/commands/vault/intent.rs:75–84  ·  view source on GitHub ↗

Resolve the active agent session for the current view. Scans `.atomic/sessions/` for a session whose `view_name` matches the repository's current view. Returns `(session_id, turn_count)` if found.

(repo: &Repository)

Source from the content-addressed store, hash-verified

73/// the repository's current view. Returns `(session_id, turn_count)`
74/// if found.
75fn resolve_active_session(repo: &Repository) -> Option<(String, u32)> {
76 let sessions_dir = repo.dot_dir().join("sessions");
77 let store = SessionStore::new(&sessions_dir).ok()?;
78 let current_view = repo.current_view();
79 let active = store.find_active().ok()?;
80 active
81 .into_iter()
82 .find(|s| s.view_name == current_view)
83 .map(|s| (s.session_id.clone(), s.turn_count))
84}
85
86// Intent Subcommands
87

Callers 1

runMethod · 0.85

Calls 5

dot_dirMethod · 0.80
current_viewMethod · 0.80
find_activeMethod · 0.80
into_iterMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected