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

Function agent_session_exists

atomic-cli/src/commands/agent/hooks.rs:934–945  ·  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

932/// Whether a durable session record exists for `session_id` in the canonical
933/// session store. Loading never creates state.
934fn agent_session_exists(repository_root: &std::path::Path, session_id: &str) -> CliResult<bool> {
935 let store = match atomic_repository::Repository::canonical_dot_dir(repository_root) {
936 Ok(dot_dir) => atomic_agent::turn::session::SessionStore::new(dot_dir.join("sessions"))
937 .map_err(|e| CliError::Internal(anyhow!("session store unavailable: {}", e)))?,
938 Err(_) => atomic_agent::turn::session::SessionStore::for_repo(repository_root)
939 .map_err(|e| CliError::Internal(anyhow!("session store unavailable: {}", e)))?,
940 };
941 store
942 .load(session_id)
943 .map(|loaded| loaded.is_some())
944 .map_err(|e| CliError::Internal(anyhow!("cannot load session {}: {}", session_id, e)))
945}
946
947impl Hooks {
948 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