regy 0.1.1

Private-by-default desktop agent for the Regy web interface
mod cli;
mod config;
mod dependencies;
mod domain;
mod infrastructure;
#[cfg(unix)]
mod operational;
mod pairing;
#[cfg(unix)]
mod presentation;
mod providers;
#[cfg(unix)]
mod runtime;
mod setup;
#[cfg(unix)]
mod transport;

#[cfg(all(test, unix))]
#[path = "../../../tests/backend/pc/mod.rs"]
mod tests;

use clap::Parser;
use domain::errors::AgentResult;
#[cfg(any(test, not(unix)))]
use domain::errors::{AgentError, ErrorCode};
pub use domain::resize::TerminalSize;
#[cfg(unix)]
pub use infrastructure::pty_session::PtySession;

#[cfg(test)]
pub(crate) use domain::{chat, errors, pi_rpc, policy, protocol};
#[cfg(all(test, unix))]
pub(crate) use infrastructure::{
    pi_history, pi_models, pi_rpc_framing, pi_rpc_process, pi_skill_runtime, pty_io, pty_session,
    reconnect,
};
#[cfg(all(test, unix))]
pub(crate) use operational::{connection_routes, pi_rpc_manager, session_manager};
#[cfg(all(test, unix))]
pub(crate) use presentation::{connection, connection_helpers, connection_output};

#[tokio::main]
async fn main() -> AgentResult<std::process::ExitCode> {
    infrastructure::logging::init();
    let args = cli::args::CliArgs::parse();
    #[cfg(unix)]
    {
        return Ok(cli::dispatch::run(args).await?.code());
    }
    #[cfg(not(unix))]
    {
        let _ = args;
        Err(AgentError::new(
            ErrorCode::InvalidMessage,
            "regy pc agent is only supported on unix",
        ))
    }
}