bux 0.9.0

Embedded micro-VM sandbox for running AI agents
//! Embedded micro-VM sandbox for running AI agents.
//!
//! `bux` wraps [`libkrun`] into a managed [`Runtime`]: create isolated
//! machines from OCI images, exec through the guest agent, and control
//! egress at the host gvproxy boundary. Sidecar `bux-shim` and `bux-guest`
//! are [`RuntimeOptions::shim_path`] / [`RuntimeOptions::guest_path`], else a
//! canonical sibling of the running executable, else `bux-pkg`, else a
//! checksum-verified GitHub fetch (`v{CARGO_PKG_VERSION}` tarball, or
//! `guest-v{GUEST_VERSION}` when a shim already exists). Missing payload:
//! `curl -fsSL https://sh.qntx.org/bux | sh`.
//!
//! # Quick start
//!
//! ```no_run
//! # #[cfg(unix)]
//! # async fn example() -> bux::Result<()> {
//! use bux::{ExecStart, Runtime, VmOptions};
//!
//! let rt = Runtime::open(bux::default_data_dir())?;
//! let mut vm = rt
//!     .create(VmOptions::from_image("python:slim").vcpus(2).ram_mib(1024))
//!     .await?;
//!
//! vm.exec_output(ExecStart::new("python").args(vec!["-c".into(), "print(1)".into()]))
//!     .await?;
//! vm.stop().await?;
//! # Ok(())
//! # }
//! ```
//!
//! [`libkrun`]: https://github.com/containers/libkrun

#[cfg(unix)]
mod client;
mod disk;
mod error;
mod events;
#[cfg(unix)]
mod guest;
#[cfg(unix)]
mod lifecycle;
mod metrics;
#[cfg(unix)]
mod options;
#[cfg(unix)]
mod payload;
mod ports;
#[cfg(unix)]
mod process;
#[cfg(unix)]
mod runtime;
#[cfg(unix)]
mod secrets;
mod security;
#[cfg(unix)]
mod snapshot;
mod state;
mod util;
#[cfg(unix)]
mod volumes;
#[cfg(unix)]
mod watchdog;

#[cfg(unix)]
pub use bux_oci::{RegistryAuth, canonical_reference};
pub use bux_proto::ExecStart;
#[cfg(unix)]
pub use client::{ExecHandle, ExecOutput, PongInfo};
pub use error::{Error, Result};
pub use events::{
    AuditEvent, AuditEventKind, CopyDirection, EventDispatcher, EventListener, RingBufferListener,
};
#[cfg(unix)]
pub use lifecycle::SweepReport;
pub use metrics::{RuntimeMetrics, VmMetrics};
#[cfg(unix)]
pub use options::{ImageRef, NetworkSpec, VmOptions};
#[cfg(unix)]
pub use payload::{GUEST_VERSION, default_payload_dir};
pub use ports::{PortSpec, PublishedPort, parse_publish_spec};
#[cfg(unix)]
pub use runtime::{
    EgressClass, HealthStatus, ImageInfo, Runtime, RuntimeOptions, Vm, VmInfo, default_data_dir,
};
#[cfg(unix)]
pub use secrets::{Secret, StartOptions};
pub use security::{HostInfo, LayerStatus, SecurityOptions, SecurityStatus};
#[cfg(unix)]
pub use snapshot::SnapshotInfo;
pub use state::Status;
#[cfg(unix)]
pub use volumes::{
    VolumeInfo, VolumeManager, VolumeMount, VolumeSource, parse_bind_spec, validate_volume_name,
};