Expand description
Library crate for mahbot.
The binary (main.rs) uses the same module tree. This crate root
provides the public API for both the dashboard and background agent dispatch.
Modules§
- audio
- Audio/voice subsystem — wake word detection, voice command pipeline, local transcription (Qwen3-ASR), and text-to-speech.
- bench_
openrouter mahbot bench-openrouter— standalone OpenRouter provider benchmark CLI.- board
- Ticket/board system — Turso-backed task management.
- channels
- checkpoint
- WAL checkpointing for all Turso database stores.
- config
- Configuration system with three independent resolution chains.
- config_
db - Config key-value pairs and per-model routing rules stored in
config.db. - debug
- Debug query tool — read-only SQL diagnostics for mahbot’s databases.
- gui
- Native Iced dashboard — application entry point, navigation, and shared state.
- jobs
- Durable job substrate: jobs/agents/pending_jobs lifecycle, boot recovery scan, and stale purge orchestration.
- lock_
utils - Shared lock utilities for single-instance enforcement.
- logs
- Turso-backed log storage.
- maintainer
- Maintainer — autonomous periodic codebase investigation agent.
- management
- Board poller — picks up tickets from the board and dispatches agents.
- message_
router - Agent-ID-based message router — replaces per-role queue with per-agent channels for true instance-level parallelism.
- providers
- Provider subsystem for model inference backends.
- registry
- Global registry of running agents with cancellation support.
- research_
cleanup - Research-run cleanup: per-run temp folders, results archive, the raw shell-command dump, and the Sanitation-agent cleanup dispatch.
- search_
engine - Shared per-workspace search engine registry.
- self_
update - Self-update logic — single-instance guarding, build, binary swap, and restart.
- session
- Session persistence — Turso-backed store + native history decoding.
- shutdown
- Global shutdown infrastructure.
- temp_
cleanup - Periodic OS temp-dir cleaner: a Sanitation-role agent that removes
clearly-old, abandoned agent artifacts from the common OS temp folder —
including the pinned daemon temp root (
/tmp/mahbot) — on the nightly discovery pass cadence. - temp_
root - Private daemon temp root: one
/tmp/mahbotroot for ALL daemon temp artifacts. - ticket_
buffer - Ticket phase transition buffer — piggyback non-critical transitions onto critical notifications and user messages.
- tools
- Tool implementations for agent-callable capabilities.
- turso
- users
- Per-user identity, permissions, workspace and role preferences, and channel bindings.
- util
- Utility modules for shared helper functions.
- wal_
guard - Detection guard for live-WAL /
.tshminconsistency artifacts. - workspace
- Workspace storage — persisted workspace metadata and contexts.
Macros§
- __
columns_ gen - Generate
COL_{prefix}_{name}index constants with positional indices. - __
columns_ join - Join literal strings with
", "separator. - columns
- Generate a column-string constant and matching column-index constants from a single source-of-truth list.
- define_
store - Generate a DB-backed store struct, its
open()constructor, and a global singleton (viacrate::global_store!). - global_
store - Declare a global
OnceCell-backed store withinit_global()andstore().
Structs§
- Agent
- Running context for an agent turn.
- Channel
Message - Channel
Registry - Registry of all active channels, keyed by
Channel::name(). - Role
Iter - An iterator over the variants of Role
- Send
Message - An outbound message to deliver on a channel.
- Workspace
- A persisted workspace entry.
Enums§
- BotCommand
- Represents a recognized Telegram bot text command.
- Chat
Direction - Direction of a chat message: from the user or from an agent.
- Chat
Event - A chat event broadcast to GUI subscribers.
- Role
- Typed role identifier for agents.
- Workspace
Status - Lifecycle status of a workspace.
Statics§
- CHANNEL_
REGISTRY - Global channel registry — channels register during startup.
- CHAT_
BROADCAST - Global broadcast channel for live chat events in the GUI.
Set during
init_message_pipeline. Capacity 256 to preventLaggederrors in burst scenarios. - GUI_
MESSAGE_ TX - Global sender for GUI-to-channel messages.
The Iced UI pushes
ChannelMessagevalues here;GuiChannel::listen()reads them from the paired receiver and forwards them into the pipeline. - MESSAGE_
TX - Global sender for the pipeline message channel.
Set during
init_message_pipeline, used byGuiChannel::listen()to forward GUI-originated messages into the shared pipeline.
Traits§
Functions§
- channel_
registry - Shorthand to get the global channel registry. Panics if not initialized — call during startup after channels are set up.
- generate_
id - Generate a unique identifier (10-char NanoID, ~60 bits entropy).
- parse_
bot_ command - Parse a Telegram bot text command from message content.
- run_
grep_ engine - Hidden grep-engine subcommand entry (dispatched from
main()before the instance lock; the shell tool’s read-only grep interception rewrites served invocations to this subcommand of the current binary). Entry point for the hidden__grep-enginesubcommand (dispatched frommain()before instance-lock acquisition).--probeanswers whether the binary still carries the subcommand (self-update version skew). Any runtime doubtexecs the real grep in place; when even that fails, the sentinel exit code tells the parent to re-run the original command.