codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
use once_cell::sync::Lazy;
use tokio::sync::Mutex;

mod io;
mod process;

static SESSION: Lazy<Mutex<Option<process::PsSession>>> = Lazy::new(|| Mutex::new(None));

pub async fn run(script: &str) -> anyhow::Result<serde_json::Value> {
    let mut guard = SESSION.lock().await;
    if guard.is_none() {
        *guard = Some(process::PsSession::start()?);
    }
    guard
        .as_mut()
        .expect("session initialized")
        .run(script)
        .await
}