magi-code 0.96.2

Repository-aware CLI coding agent for terminal work
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Exclusive writer admission, separate from shared retention protection.
use super::Session;
use crate::persistence::CrossProcessFileLock;

impl Session {
    pub(crate) fn try_frontend_writer(&self) -> anyhow::Result<Option<CrossProcessFileLock>> {
        let root = self
            .path
            .parent()
            .ok_or_else(|| anyhow::anyhow!("missing root"))?;
        super::store::prepare_session_root(root)?;
        CrossProcessFileLock::try_acquire(&self.path.with_extension("writer"))
    }
}