Skip to main content

Crate mahbot

Crate mahbot 

Source
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§

agent
board
Ticket/board system — Turso-backed task management.
channels
chat_history
Chat history persistence — stores all chat messages (both user and agent) for GUI display and history loading. Messages are written at the point of delivery: incoming user messages from the GUI send path, outgoing agent responses from GuiChannel::send().
checkpoint
WAL checkpointing for all Turso database stores.
config
config_db
Config key-value, per-role model overrides, and per-model routing rules stored in config.db.
debug
Debug query tool — read-only SQL diagnostics for mahbot’s databases.
diff_parse
Git diff parsing — parse unified diff output into structured data.
embedder
Semantic (vector/embedding) search for archived tickets.
extraction
Structured extraction from conversation history.
gui
Native Iced dashboard — application entry point, navigation, and shared state.
logs
Turso-backed log storage.
maintainer
Maintainer — autonomous periodic codebase investigation agent.
management
Board poller — picks up tickets from the board and dispatches agents.
manager_queue
Manager queue — serializes all Manager agent requests through a single consumer task. Eliminates concurrent Manager agent races by processing one job at a time.
prompt
providers
Provider subsystem for model inference backends.
registry
Global registry of running agents with cancellation support.
role
Role metadata consolidation — single source of truth for all static Role properties.
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.
skills
Skills subsystem — loads workspace skills and injects them into prompts.
stats
Per-agent tool call statistics stored in stats.db.
ticket_buffer
Ticket status accumulation 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.
vector
Vector operations — cosine similarity, hybrid merge, serialization.
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 (via [global_store!]).
global_store
Declare a global OnceCell-backed store with init_global() and store().

Structs§

Agent
Running context for an agent turn.
ChannelMessage
ChannelRegistry
Registry of all active channels, keyed by Channel::name().
ChatMessage
ChatRequest
ChatResponse
DiagnosticsCommands
Discovered diagnostic commands for a workspace.
ProviderUsage
Reasoning
RoleIter
An iterator over the variants of Role
SanitationVerdict
Result of a sanitation agent’s file inspection.
SendMessage
An outbound message to deliver on a channel.
Skill
A skill is a user-defined or community-built capability. Skills live in <workspace>/skills/<name>/ (also <workspace>/.claude/skills/<name>/ and <workspace>/.agents/skills/<name>/) and are defined via SKILL.md. They provide instructions and context for the agent.
StreamChunk
ToolCall
ToolCallRecord
A single tool call record, stored per-call in the stats database.
ToolSpec
Verdict
Result of a single review or QA verification pass.
Workspace
A persisted workspace entry.

Enums§

ChatDirection
Direction of a chat message: from the user or from an agent.
ChatEvent
A chat event broadcast to GUI subscribers.
MessageRole
Typed role for a ChatMessage.
Role
Typed role identifier for agents.
StreamError
Structured error for streaming responses.
StreamEvent
ToolOutputPhase
Phase of tool output notification.

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 prevent Lagged errors in burst scenarios.
GUI_MESSAGE_TX
Global sender for GUI-to-channel messages. The Iced UI pushes ChannelMessage values 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 by GuiChannel::listen() to forward GUI-originated messages into the shared pipeline.

Traits§

Channel
Provider
Tool

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).
generate_suffix
Generate a short unique suffix (6-char NanoID, ~36 bits entropy). Used to disambiguate retry cycles in parallel agent dispatches.
is_start_command
Check whether content is a /start command.

Type Aliases§

StreamResult