// PART 00
Source map
botserver is not a single crate. The repository is a Cargo workspace with
123 members, version 7.1.2 ([workspace.package] version in the root
Cargo.toml). Two vendored office-document crates (3rdparty/docx-rs,
3rdparty/umya-spreadsheet) are explicitly excluded from the workspace.
Everything on this page is derived from the manifests and the source tree:
python3 - <<'PY'
import re
t = open("Cargo.toml", encoding="utf-8").read()
i = t.index("\nmembers = [") + 1
j = t.index("[", i)
depth = 0
for k in range(j, len(t)):
if t[k] == "[": depth += 1
elif t[k] == "]":
depth -= 1
if depth == 0:
print(len(re.findall(r'"([^"]+)"', t[j:k])))
break
PY
Workspace layout
| Group | Members | Location |
|---|---|---|
| Application crates | 6 | botserver, botui, botlib, botschema, bottest, botapp |
| Feature crates | 117 | botserver/crates/* |
| Vendored, excluded | 2 | 3rdparty/docx-rs, 3rdparty/umya-spreadsheet |
[workspace] default-members is botserver, botui, botlib, botschema —
a bare cargo build at the root builds those four, not the 117 feature crates.
| Member | Kind | Responsibility |
|---|---|---|
botserver |
binary crate | HTTP/WS server, bootstrap, route mounting, BASIC host |
botui |
binary crate | static front ends for suite (3000), cloud (4000), login (5000) |
botlib |
library | shared models, MessageType, i18n catalogs, database helpers |
botschema |
library | the single home of every Diesel table! macro |
bottest |
test crate | cross-crate integration suites |
botapp |
binary (Tauri 2) | desktop shell that supervises the botserver sidecar |
botserver has no library target
botserver/Cargo.toml declares no [lib] and no [[bin]]; the binary is the
default src/main.rs. There is no src/lib.rs, so nothing is “exported for
external use”. Consequences:
cargo test -p botserverfails with “no library targets found”; unit tests build withcargo test -p botserver --bin botserver.- Other crates cannot
use botserver::...; they depend onbotcore,botbasic_*,botsecurity*and the other libraries instead.
Every other top-level module of the binary is feature-gated
(#[cfg(feature = "…")]), e.g. analytics, billing, vibe, basic
(scripting).
Request flow through the tree
src/main.rs
└── main_module::init bootstrap: config → Vault → DB pool → cache
└── main_module::server Axum router, middleware, auth + rate limits
├── main_module/routes/* hand-written route modules
├── botserver/crates/*/routes* feature routers mounted per crate
└── core::bot/ws WebSocket chat pipeline
└── basic/ BASIC interpreter (.gbdialog → .ast)
└── crates/botbasic_* keyword families
main_module/— process-level wiring:init.rs,server/,routes/,drive_monitors/,git_bot_monitor/,ui_plan/,state_builder.rs,background.rs,shutdown.rs.core/— runtime state and the chat engine:state.rs,config.rs,secrets/,session/,bot/(withws/,api_catalog/,pipeline/,kb_context/,sandbox/,runs/),directory/,oauth/.basic/— the BASIC host: parser wiring andkeywords/registration.apps/— the suite app registry (registry/) and per-app command surfaces (commands/).security/—SafeCommand,log_and_sanitize, SQL guards, rate limits.- Domain directories —
crm/,billing/,people/,drive/,learn/,vibe/,meet/,whatsapp/, … each a thin host over a feature crate.
Reading a crate’s responsibility
Each feature crate’s own Cargo.toml carries a description; where it does,
that line is the honest one-sentence summary (for example botbasic_ai —
“BASIC AI/intelligence keywords - LLM, AI tools, MCP, sandbox, orchestration,
web scraping”). Many manifests carry none; for those the directory name is all
you get until you read lib.rs. Never assume a responsibility from a name
alone.
Never claim a workspace crate is a module of the botserver binary: a crate is
reached through dep:<crate> in a feature and mounted by a host module.
Build and test commands that work
cargo build -p botserver # the server binary
cargo build -p botserver --no-default-features --features minimal
cargo test -p botcore # any library crate
cargo test -p botserver --bin botserver # binary-crate unit tests
cargo test -p bottest # cross-crate integration
cargo check -p <crate> # syntax/type gate