wabot 0.2.0

Wabot framework — umbrella crate re-exporting wabot-core and wabot-macros.
Documentation
//! # wabot
//!
//! Umbrella crate. Re-exports the [`wabot_core`] foundations and the
//! [`wabot_macros`] decorators so consumers only need:
//!
//! ```ignore
//! use wabot::prelude::*;
//! ```
//!
//! Optional feature crates are exposed under their own modules:
//!
//! * [`rest`]    — REST controllers on axum (feature `rest`, default).
//! * [`chat`]    — chat controllers + channel framework (feature `chat`, default).
//! * [`chatbot`] — chat-bot orchestrator + mindset framework (feature `chatbot`, default).
//! * [`mindset`] — Mindset trait + operator + tool definitions
//!   (tools themselves live in [`tool`], shared with agents).
//! * [`agent`] — programmatically-driven LLM sessions (`ask` / `confirm`
//!   / `order`) and mindset→agent delegation.
//! * [`testing`] — harnesses that drive the real stack against a
//!   scriptable LLM (feature `testing`, opt-in).
//! * [`addons::cmd`]       — CLI channel addon (feature `addon-cmd`, default).
//! * [`addons::telegram`]  — Telegram channel addon (feature `addon-telegram`, opt-in).
//! * [`addons::socket`]    — Socket.IO channel addon (feature `addon-socket`, opt-in).
//! * [`addons::anthropic`] — Anthropic Claude chat adapter (feature `addon-anthropic`, opt-in).
//! * [`addons::openai`]    — OpenAI chat adapter (feature `addon-openai`, opt-in).
//! * [`addons::deepseek`]  — DeepSeek chat adapter (feature `addon-deepseek`, opt-in).
//! * [`addons::google`]    — Google Gemini chat adapter (feature `addon-google`, opt-in).
//! * [`addons::openrouter`] — OpenRouter chat adapter (feature `addon-openrouter`, opt-in).
//! * [`addons::wabot_llm`] — Wabot LLM proxy adapter (feature `addon-wabot`, opt-in).
//! * [`addons::mindset_html`] — HTML-fetch-to-text mindset module (feature `addon-mindset-html`, opt-in).
//! * [`async_jobs`] — async / cron job framework (feature `async-jobs`, opt-in).
//! * [`addons::async_memory`] — in-memory job + cron repository (feature `addon-async-memory`, opt-in).
//! * [`pg`] — Postgres pool + JSONB store + advisory-lock Locker (feature `pg`, opt-in).
//! * [`addons::async_pg`] — Postgres job + cron repository (feature `addon-async-pg`, opt-in).
//! * [`addons::chat_bot_pg`] — Postgres chat repository + memory (feature `addon-chat-bot-pg`, opt-in).
//! * [`ui`] — server-rendered pages with islands (features `ui` = Maud, `ui-hypertext` = rsx, `ui-tsx` = TSX via QuickJS).
//! * [`addons::auth_jwt`] — JWT guard + signer (feature `addon-auth-jwt`, opt-in).
//! * [`addons::auth_api_key`] — API-key guard + repository (feature `addon-auth-api-key`, opt-in).

pub use wabot_core::{
    audit, config, description, entity, idempotency, injection, log_context, mapper, rate_limit,
    register_singletons, repository, storable, validation,
};

/// Decorator-style macros — direct counterparts to wabot-ts decorators.
pub use wabot_macros::{
    action, chat_controller, cmd, command, command_handler, cron_command, cron_handler, delete,
    description, get, head, injectable, max_body, middleware, mindset_lang, mindset_module,
    mindset_tool, on_socket_event, patch, post, put, raw, rest_controller, singleton, socket,
    socket_controller, telegram, tool, tool_lang, tools, ui_controller, view, Validate,
};

/// Hidden re-export so proc-macros emitted in user crates that only
/// depend on the umbrella `wabot` crate can still resolve a path to the
/// core types via `::wabot::__wabot_core`. Implementation detail.
#[doc(hidden)]
pub use wabot_core as __wabot_core;

/// Graceful shutdown, cooperative cancellation, and the `sd_notify`
/// handshake with systemd.
///
/// Re-exported because [`runner::ProjectRunner`] hands out a
/// [`Cancel`](wabot_core::lifecycle::Cancel) and registers
/// [`ShutdownTask`](wabot_core::lifecycle::ShutdownTask)s: composing an
/// application should not require reaching past the umbrella into
/// `wabot-core`.
pub mod lifecycle {
    pub use wabot_core::lifecycle::*;
}

/// REST controllers on axum. Enabled by the `rest` feature (default).
#[cfg(feature = "rest")]
pub mod rest {
    pub use wabot_feature_rest_controller::*;
}

/// Chat controllers + channel framework. Enabled by `chat` (default).
#[cfg(feature = "chat")]
pub mod chat {
    pub use wabot_feature_chat_controller::*;
}

/// Chat-bot orchestrator + data types. Enabled by `chatbot` (default).
/// Pulls in the [`mindset`] module as a peer.
#[cfg(feature = "chatbot")]
pub mod chatbot {
    pub use wabot_feature_chat_bot::*;
}

/// The tool runtime shared by mindsets and agents — `#[tools]`
/// definitions, the schema shipped to the model, and gating.
/// Enabled together with `chatbot`.
#[cfg(feature = "chatbot")]
pub mod tool {
    pub use wabot_feature_tool::*;
}

/// Mindset framework — Mindset trait, MindsetOperator, tool definitions.
/// Enabled together with `chatbot`.
#[cfg(feature = "chatbot")]
pub mod mindset {
    pub use wabot_feature_mindset::*;
}

/// Test harnesses: a scriptable LLM plus chat-bot and agent harnesses
/// that drive the real production paths. Enabled by `testing`
/// (opt-in) — put it under `[dev-dependencies]`.
#[cfg(feature = "testing")]
pub mod testing {
    pub use wabot_testing::*;
}

/// Agents — LLM sessions you drive from code: typed answers, tool
/// gating, budgets, and delegation from a mindset. Enabled together
/// with `chatbot`.
#[cfg(feature = "chatbot")]
pub mod agent {
    pub use wabot_feature_agent::*;
}

/// Socket.IO controllers — namespaces, handshake middlewares, events
/// with acks. Enabled by `socket-controller` (opt-in).
///
/// Named `sockets` rather than `socket_controller` so it can't shadow
/// the `#[socket_controller]` attribute, the way `async_jobs` avoids
/// colliding with the async macros.
#[cfg(feature = "socket-controller")]
pub mod sockets {
    pub use wabot_feature_socket_controller::*;
}

/// Async / cron job framework. Enabled by `async-jobs` (opt-in).
#[cfg(feature = "async-jobs")]
pub mod async_jobs {
    pub use wabot_feature_async::*;
}

/// Postgres foundation — pool, JSONB document store, advisory-lock
/// `Locker`. Enabled by `pg` (opt-in).
#[cfg(feature = "pg")]
pub mod pg {
    pub use wabot_feature_pg::*;
}

/// SQLite foundation — embedded engine, JSON document store,
/// migrations. Enabled by `sqlite` (opt-in). The single-node
/// counterpart to [`pg`].
#[cfg(feature = "sqlite")]
pub mod sqlite {
    pub use wabot_feature_sqlite::*;
}

/// Server-rendered UI pages — views, actions, islands, boosted
/// navigation. Enabled by `ui` (opt-in). The Maud renderer lives at
/// [`ui::maud`].
#[cfg(any(feature = "ui", feature = "ui-hypertext", feature = "ui-tsx"))]
pub mod ui {
    pub use wabot_feature_ui_controller::*;

    /// Maud renderer helpers: `into_view()`, `island()`, `outlet()`.
    /// Enabled by `ui`.
    #[cfg(feature = "ui")]
    pub use wabot_addon_ui_maud as maud;

    /// hypertext (rsx/JSX-style) renderer helpers. Enabled by
    /// `ui-hypertext`.
    #[cfg(feature = "ui-hypertext")]
    pub use wabot_addon_ui_hypertext as hypertext;
}

/// Channel + adapter + mindset addons. Enable individually via
/// `addon-*` features.
#[cfg(any(
    feature = "addon-cmd",
    feature = "addon-telegram",
    feature = "addon-socket",
    feature = "addon-anthropic",
    feature = "addon-openai",
    feature = "addon-deepseek",
    feature = "addon-google",
    feature = "addon-openrouter",
    feature = "addon-wabot",
    feature = "addon-mindset-html",
    feature = "addon-async-memory",
    feature = "addon-async-pg",
    feature = "addon-chat-bot-pg",
    feature = "addon-auth-jwt",
    feature = "addon-auth-api-key",
))]
pub mod addons {
    /// CLI (stdin/stdout) channel. Enabled by `addon-cmd` (default).
    #[cfg(feature = "addon-cmd")]
    pub use wabot_addon_chat_controller_cmd as cmd;

    /// Telegram channel. Enabled by `addon-telegram` (opt-in).
    #[cfg(feature = "addon-telegram")]
    pub use wabot_addon_chat_controller_telegram as telegram;

    /// Socket.IO channel. Enabled by `addon-socket` (opt-in).
    #[cfg(feature = "addon-socket")]
    pub use wabot_addon_chat_controller_socket as socket;

    /// Anthropic Claude chat adapter. Enabled by `addon-anthropic` (opt-in).
    #[cfg(feature = "addon-anthropic")]
    pub use wabot_addon_chat_bot_anthropic as anthropic;

    /// OpenAI chat adapter. Enabled by `addon-openai` (opt-in).
    #[cfg(feature = "addon-openai")]
    pub use wabot_addon_chat_bot_openai as openai;

    /// DeepSeek chat adapter. Enabled by `addon-deepseek` (opt-in).
    #[cfg(feature = "addon-deepseek")]
    pub use wabot_addon_chat_bot_deepseek as deepseek;

    /// Google Gemini chat adapter. Enabled by `addon-google` (opt-in).
    #[cfg(feature = "addon-google")]
    pub use wabot_addon_chat_bot_google as google;

    /// OpenRouter chat adapter (multi-provider proxy). Enabled by
    /// `addon-openrouter` (opt-in).
    #[cfg(feature = "addon-openrouter")]
    pub use wabot_addon_chat_bot_openrouter as openrouter;

    /// Wabot LLM proxy adapter (forwards to a remote wabot service).
    /// Aliased to `wabot_llm` to avoid colliding with this `wabot` crate.
    #[cfg(feature = "addon-wabot")]
    pub use wabot_addon_chat_bot_wabot as wabot_llm;

    /// HTML-fetch-to-text mindset module. Enabled by
    /// `addon-mindset-html` (opt-in).
    #[cfg(feature = "addon-mindset-html")]
    pub use wabot_addon_mindset_html as mindset_html;

    /// In-memory job + cron repository for `async-jobs`. Enabled by
    /// `addon-async-memory` (opt-in).
    #[cfg(feature = "addon-async-memory")]
    pub use wabot_addon_async_in_memory as async_memory;

    /// Postgres job + cron repository for `async-jobs`. Enabled by
    /// `addon-async-pg` (opt-in).
    #[cfg(feature = "addon-async-pg")]
    pub use wabot_addon_async_pg as async_pg;

    /// Postgres chat repository + chat memory. Enabled by
    /// `addon-chat-bot-pg` (opt-in).
    #[cfg(feature = "addon-chat-bot-pg")]
    pub use wabot_addon_chat_bot_pg as chat_bot_pg;

    /// JWT guard + signer. Enabled by `addon-auth-jwt` (opt-in).
    #[cfg(feature = "addon-auth-jwt")]
    pub use wabot_addon_auth_jwt as auth_jwt;

    /// API-key guard + repository. Enabled by `addon-auth-api-key`
    /// (opt-in).
    #[cfg(feature = "addon-auth-api-key")]
    pub use wabot_addon_auth_api_key as auth_api_key;
}

/// One-stop import for everything most apps need.
pub mod prelude {
    pub use wabot_core::audit::{audit_actor, set_audit_actor, set_audit_source, AuditActor};
    pub use wabot_core::auth::{Auth, AuthError};
    pub use wabot_core::log_context::{
        add_log_field, log_context, request_id, run_with_log_context, LogContext,
    };
    pub use wabot_core::prelude::*;
    pub use wabot_core::{register_singletons, register_transients};
    #[cfg(feature = "chatbot")]
    pub use wabot_feature_agent::{
        agent_binding, register_agents, Agent, AgentBudget, AgentError, AgentFactory, AgentReply,
        AgentSession,
    };
    #[cfg(feature = "async-jobs")]
    pub use wabot_feature_async::{
        register_async_runtime, run_async_workers, schedule_job, AsyncError, AsyncRuntimeConfig,
        CommandHandlerEntry, CommandRegistry, CronHandlerEntry, CronRegistry, JobOptions,
    };
    #[cfg(feature = "chatbot")]
    pub use wabot_feature_chat_bot::{
        Chat, ChatAdapter, ChatBot, ChatConnection, ChatMessage, ChatRepository, ChatType,
        InMemoryChatMemory, InMemoryChatRepository,
    };
    #[cfg(feature = "chat")]
    pub use wabot_feature_chat_controller::{
        run_chat_controllers, ChannelError, ChatChannel, ReceivedMessage, ReplyHandle,
    };
    #[cfg(feature = "chatbot")]
    pub use wabot_feature_mindset::{
        Mindset, MindsetCache, MindsetCacheConfig, MindsetDescription, MindsetIdentity,
        MindsetModelRef, MindsetModels, MindsetOperator, ModelKind, ToolDefinition, ToolGate,
        ToolSchema,
    };
    #[cfg(feature = "pg")]
    pub use wabot_feature_pg::{PgConfig, PgDatabase, PgError, PgLocker, PgResult};
    #[cfg(feature = "rest-tls")]
    pub use wabot_feature_rest_controller::TlsMode;
    #[cfg(feature = "rest")]
    pub use wabot_feature_rest_controller::{
        Middleware, RequestContextLayer, RestError, RestResult, RestServerConfig,
    };
    #[cfg(feature = "sqlite")]
    pub use wabot_feature_sqlite::{
        SqliteConfig, SqliteDatabase, SqliteError, SqliteJsonbStore, SqliteResult,
    };
    #[cfg(any(feature = "ui", feature = "ui-hypertext", feature = "ui-tsx"))]
    pub use wabot_feature_ui_controller::{
        embedded_assets,
        run_ui_controllers,
        ui_router,
        EmbeddedAsset,
        Redirect,
        UiError,
        UiResult,
        // `ViewOutcome` travels with `Redirect`: a view that can
        // redirect returns one, so exporting the redirect without the
        // type that carries it is half an export.
        ViewBody,
        ViewOutcome,
    };
    pub use wabot_macros::{
        action, chat_controller, cmd, command, command_handler, cron_command, cron_handler, delete,
        description, get, head, injectable, max_body, middleware, mindset_lang, mindset_module,
        mindset_tool, on_socket_event, patch, post, put, raw, rest_controller, singleton, socket,
        socket_controller, telegram, tool, tool_lang, tools, ui_controller, view, Validate,
    };
}

pub mod runner;
pub use runner::ProjectRunner;