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

Function agent_session_exists

atomic-cli/src/commands/agent/hooks.rs:708–719  ·  view source on GitHub ↗

Whether a durable session record exists for `session_id` in the canonical session store. Loading never creates state.

(repository_root: &std::path::Path, session_id: &str)

Source from the content-addressed store, hash-verified

706/// Whether a durable session record exists for `session_id` in the canonical
707/// session store. Loading never creates state.
708fn agent_session_exists(repository_root: &std::path::Path, session_id: &str) -> CliResult<bool> {
709 let store = match atomic_repository::Repository::canonical_dot_dir(repository_root) {
710 Ok(dot_dir) => atomic_agent::turn::session::SessionStore::new(dot_dir.join("sessions"))
711 .map_err(|e| CliError::Internal(anyhow!("session store unavailable: {}", e)))?,
712 Err(_) => atomic_agent::turn::session::SessionStore::for_repo(repository_root)
713 .map_err(|e| CliError::Internal(anyhow!("session store unavailable: {}", e)))?,
714 };
715 store
716 .load(session_id)
717 .map(|loaded| loaded.is_some())
718 .map_err(|e| CliError::Internal(anyhow!("cannot load session {}: {}", session_id, e)))
719}
720
721impl Hooks {
722 fn should_handoff_codex_lifecycle(&self, managed: bool) -> bool {

Callers 1

guard_agent_boundaryFunction · 0.85

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected