Expand description
§wabot
Umbrella crate. Re-exports the wabot_core foundations and the
wabot_macros decorators so consumers only need:
ⓘ
use wabot::prelude::*;Optional feature crates are exposed under their own modules:
rest— REST controllers on axum (featurerest, default).chat— chat controllers + channel framework (featurechat, default).chatbot— chat-bot orchestrator + mindset framework (featurechatbot, 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 (featuretesting, opt-in). addons::cmd— CLI channel addon (featureaddon-cmd, default).- [
addons::telegram] — Telegram channel addon (featureaddon-telegram, opt-in). - [
addons::socket] — Socket.IO channel addon (featureaddon-socket, opt-in). - [
addons::anthropic] — Anthropic Claude chat adapter (featureaddon-anthropic, opt-in). - [
addons::openai] — OpenAI chat adapter (featureaddon-openai, opt-in). - [
addons::deepseek] — DeepSeek chat adapter (featureaddon-deepseek, opt-in). - [
addons::google] — Google Gemini chat adapter (featureaddon-google, opt-in). - [
addons::openrouter] — OpenRouter chat adapter (featureaddon-openrouter, opt-in). - [
addons::wabot_llm] — Wabot LLM proxy adapter (featureaddon-wabot, opt-in). - [
addons::mindset_html] — HTML-fetch-to-text mindset module (featureaddon-mindset-html, opt-in). - [
async_jobs] — async / cron job framework (featureasync-jobs, opt-in). - [
addons::async_memory] — in-memory job + cron repository (featureaddon-async-memory, opt-in). - [
pg] — Postgres pool + JSONB store + advisory-lock Locker (featurepg, opt-in). - [
addons::async_pg] — Postgres job + cron repository (featureaddon-async-pg, opt-in). - [
addons::chat_bot_pg] — Postgres chat repository + memory (featureaddon-chat-bot-pg, opt-in). - [
ui] — server-rendered pages with islands (featuresui= Maud,ui-hypertext= rsx,ui-tsx= TSX via QuickJS). - [
addons::auth_jwt] — JWT guard + signer (featureaddon-auth-jwt, opt-in). - [
addons::auth_api_key] — API-key guard + repository (featureaddon-auth-api-key, opt-in).
Re-exports§
pub use runner::ProjectRunner;
Modules§
- addons
- Channel + adapter + mindset addons. Enable individually via
addon-*features. - agent
- Agents — LLM sessions you drive from code: typed answers, tool
gating, budgets, and delegation from a mindset. Enabled together
with
chatbot. - audit
- Who caused a change. Port of
wabot-ts/src/core/audit. - chat
- Chat controllers + channel framework. Enabled by
chat(default). - chatbot
- Chat-bot orchestrator + data types. Enabled by
chatbot(default). Pulls in themindsetmodule as a peer. - config
- Declarative configuration read from the environment. Port of
wabot-ts/src/core/config. - description
- Description metadata — human-readable text attached to fields and methods, used by the mindset layer to build LLM tool schemas.
- entity
- Entity — Storable + identity, timestamps, and protected-field-aware update.
- idempotency
- Handle a repeated delivery once. Port of
wabot-ts/src/core/idempotency. - injection
- Dependency injection — the foundation everything else in the framework
sits on. See
container::Container. - lifecycle
- Graceful shutdown, cooperative cancellation, and the
sd_notifyhandshake with systemd. - log_
context - Correlation fields that follow a unit of work across
.awaitpoints. Behind theasync-contextfeature (on by default) because it is the one part of core that needs a task-local, and so an async runtime — see the note in CLAUDE.md about keeping core runtime-free. Correlation fields that follow a unit of work. Port ofwabot-ts/src/core/logger/logContext.ts. - mapper
- Convert one shape into another, validating on the way. Port of
wabot-ts/src/core/mapper. - mindset
- Mindset framework — Mindset trait, MindsetOperator, tool definitions.
Enabled together with
chatbot. - prelude
- One-stop import for everything most apps need.
- rate_
limit - Fixed-window rate limiting. Port of
wabot-ts/src/core/rate-limit. - repository
- Storage-agnostic repository traits. Port of
wabot-ts/src/core/repository. - rest
- REST controllers on axum. Enabled by the
restfeature (default). - runner
- Run a whole application: every subsystem, one shutdown. Port of
wabot-ts/src/feature/project-runner. - storable
- Storable — generic, serialization-safe data container.
- tool
- The tool runtime shared by mindsets and agents —
#[tools]definitions, the schema shipped to the model, and gating. Enabled together withchatbot. - validation
- Validation system — declarative field validators with introspectable metadata.
Macros§
- register_
singletons - Register every
#[singleton]-annotated type in one call.
Attribute Macros§
- action
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@action('name')— marker on a method inside a#[ui_controller]impl block. BecomesPOST <controller>/_action/<name>returning JSON; the name defaults to the method name. - chat_
controller - Decorator-style macros — direct counterparts to wabot-ts decorators.
@chatController()— apply to animpl Controllerblock. Walks every method; methods carrying a channel marker (#[cmd], future#[telegram]/#[socket], …) are wired into a per-channel dispatch closure, and aSelf::register_channels(&Container, Arc<ChatResolver>)function is emitted that hands each channel its dispatch vialisten. - cmd
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@cmd()— marks a method inside a#[chat_controller]impl block as the handler for the CLI (CmdChannel) channel. Inert outside a#[chat_controller]impl block. - command
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@command('name')— apply to a command-payload struct. BakesSelf::COMMAND_NAME = "name"and animpl CommandDataso the typedrun_command/schedule_commandhelpers can find the name. The struct must also deriveSerialize + Deserialize. - command_
handler - Decorator-style macros — direct counterparts to wabot-ts decorators.
@commandHandler({ command, ...options })— apply to a handler struct. EmitsSelf::__handler_entry(&Container) -> CommandHandlerEntryso the runtime can dispatch byCOMMAND_NAME. The handler must implementasync fn handle(&self, cmd: MyCommand) -> Result<(), E: Display>on a separate inherent impl, and the struct itself must be#[injectable]. - cron_
command - Decorator-style macros — direct counterparts to wabot-ts decorators.
@cronCommand({ name, cron })— apply to a command struct that’s fired periodically. BakesCOMMAND_NAME+CRON_SCHEDULE. - cron_
handler - Decorator-style macros — direct counterparts to wabot-ts decorators.
@cronHandler({ ...config })— apply to a handler struct. EmitsSelf::__cron_entry(&Container) -> CronHandlerEntry. The handler must implementasync fn handle(&self) -> Result<(), E: Display>(cron handlers carry no arguments) and the struct must be#[injectable]. - delete
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@onDelete(...)— see [get]. - description
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@description("...")— attaches a human-readable description to a field or method. On struct fields it is consumed by#[derive(Validate)]and folded into [PropertyInfo::description]. On methods it is consumed by mindset macros (later phase). Used standalone, the attribute is a no-op so it never appears as “unknown attribute”. - get
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@onGet(...)— marks a method inside a#[rest_controller]impl block as an HTTP GET endpoint. Inert when used outside such a block. - head
- Decorator-style macros — direct counterparts to wabot-ts decorators.
#[head("…")]— the headers a GET would answer with, and no body. - injectable
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@injectable()— emits aSelf::inject(&Container) -> Arc<Self>constructor that resolves eachArc<T>field from the container and fills the rest fromDefault. Does not auto-register; pair with#[singleton]or callcontainer.register_*manually. - max_
body - Decorator-style macros — direct counterparts to wabot-ts decorators.
#[max_body(N)]— how many bytes this endpoint buffers before refusing the request. Defaults toDEFAULT_MAX_BODY(1 MiB), which is generous for a REST payload and mean for a file upload. - middleware
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@middleware(MyMiddleware)— attaches a middleware to the next endpoint method. Multiple#[middleware(...)]attributes stack; they run in source order before the handler. Inert outside a#[rest_controller]impl block. - mindset_
lang - Decorator-style macros — direct counterparts to wabot-ts decorators.
Deprecated alias of
tool_lang. - mindset_
module - Decorator-style macros — direct counterparts to wabot-ts decorators.
Deprecated alias of
tools, from when tool sets were a mindset-only concept. - mindset_
tool - Decorator-style macros — direct counterparts to wabot-ts decorators.
Deprecated alias of
tool. - on_
socket_ event - Decorator-style macros — direct counterparts to wabot-ts decorators.
#[on_socket_event("name")]— marker on one method inside a#[socket_controller]impl block. Inert outside such a block. - patch
- Decorator-style macros — direct counterparts to wabot-ts decorators.
#[patch("…")]— a partial update. See [get]. - post
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@onPost(...)— see [get]. - put
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@onPut(...)— see [get]. - raw
- Decorator-style macros — direct counterparts to wabot-ts decorators.
#[raw]— take theRequestand return theResponseuntouched. - rest_
controller - Decorator-style macros — direct counterparts to wabot-ts decorators.
@restController('/path')— apply to animpl Controllerblock. The macro walks every method, finds the#[get]/#[post]/#[put]/#[delete]/#[middleware]attributes, and emits aSelf::register_routes(&Container, axum::Router) -> axum::Routerfunction that adds every endpoint nested under the controller’s base path. - singleton
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@singleton()— like#[injectable], but additionally registers the type as a singleton viainventory. Equivalent to writingcontainer.register_singleton_factory::<Self, _>(|c| Self::inject(c))at framework startup, except the registration is collected at compile time so a freshContainer::new()already knows about it. - socket
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@socket()— marks a method as the handler for the Socket.IO (SocketChannel) channel. Namespace + bind address come from the runtime-registeredSocketChannelConfigsingleton. Inert outside a#[chat_controller]impl block. - socket_
controller - Decorator-style macros — direct counterparts to wabot-ts decorators.
@socketController('/ns')— apply to animpl MyControllerblock. Walks every method, finds those carrying#[on_socket_event("name")], and emitsSelf::register_socket_handlers(&Container, &SocketIo). - telegram
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@telegram()— marks a method as the handler for the Telegram (TelegramChannel) channel. The bot token is supplied at runtime via a registeredArc<TelegramChannelConfig>singleton, not as an attribute argument. Inert outside a#[chat_controller]impl block. - tool
- Decorator-style macros — direct counterparts to wabot-ts decorators.
#[tool("description")]— marker on one method inside a#[tools]impl block. Inert outside such a block — the enclosing macro reads it and strips it. - tool_
lang - Decorator-style macros — direct counterparts to wabot-ts decorators.
#[tool_lang("english")]— per-method language override, when one tool’s description is written in a different language from the rest of its set. Inert outside a#[tools]impl block. - tools
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@tools()— apply to animpl MyToolsblock. Walks every method, finds those carrying#[tool("description")], and emits aSelf::register_tools(&Container) -> Vec<ToolDefinition>helper. The struct must be#[injectable](or#[singleton]) so dispatch can resolve it from the container. - ui_
controller - Decorator-style macros — direct counterparts to wabot-ts decorators.
@uiController({ path, app, layout })— apply to the controller’simplblock. Walks every method, interprets#[view],#[action]and#[middleware], and emitsSelf::register_ui_routes. - view
- Decorator-style macros — direct counterparts to wabot-ts decorators.
@view('/path')— marker on a method inside a#[ui_controller]impl block. The method takes&selfplus at most one typed request and returnsUiResult<ViewBody>(orUiResult<ViewOutcome>to redirect).
Derive Macros§
- Validate
- Decorator-style macros — direct counterparts to wabot-ts decorators.
#[derive(Validate)]— generates aValidateimpl that owns aModelInfodescribing the struct and avalidate()that runs every declared constraint against an instance.