agent-hub-runtime 0.6.0

AgentHub desktop and companion CLI runtime for Tauri applications
Documentation
//! Shared AgentHub application library for the desktop host and CLI.

mod desktop;
mod smoke;
mod window_layout;

#[cfg(feature = "companion-cli")]
#[path = "cli/agent-hub-cli.rs"]
pub mod cli;

pub mod product;

pub mod commands;
pub mod core;

/// Read a resource from the pinned default catalog at compile time.
macro_rules! default_content {
    ($path:literal) => {
        include_str!(concat!(env!("AGENT_HUB_DEFAULT_CONTENT_DIR"), "/", $path))
    };
}
pub(crate) use default_content;

pub use desktop::builder;
pub use desktop::lifecycle::{quit_app, restart_app, QUITTING};
pub use desktop::tray::{set_tray_icon_enabled, ProductTrayIcons};
pub use smoke::run_package_smoke;

pub(crate) use desktop::tray::{refresh_tray_menu, schedule_tray_refresh};

/// Initialize the product identity before constructing a custom desktop host.
pub fn builder_for_product(
    identity: product::Identity,
) -> anyhow::Result<tauri::Builder<tauri::Wry>> {
    product::initialize(identity)?;
    builder()
}

/// Run a desktop host using its configuration and bundled frontend assets.
///
/// Generate the Context in the executable crate. Hosts that add plugins can
/// instead call [`builder`] and then run the configured builder themselves.
pub fn run(context: tauri::Context<tauri::Wry>) {
    builder()
        .expect("Failed to initialize app state")
        .run(context)
        .expect("error while running tauri application");
}