Skip to main content

archivist_core/
lib.rs

1//! # archivist-core
2//!
3//! Platform-neutral core for the FicHub companion bot.
4//!
5//! This crate contains ALL business logic shared by every platform adapter:
6//!
7//! - `api` — typed FicHub REST API client (`FichubClient`)
8//! - `model` — response/request structs
9//! - `cache` — Redis pagination + response cache shared with FicHub
10//! - `store` — token store (`/link` flow) + pending-link codes
11//! - `config` — environment-driven `BotConfig`
12//! - `error` — `BotError` (no platform-specific variants)
13//! - `util` — URL detection, word formatting, truncation
14//! - `core` — the platform-neutral `PlatformMessage` IR + `RichItem` + buttons
15//! - `dispatch` — `CoreCtx` + every `do_*` command (search, ask, quote, body,
16//!   recs, roll, download, bookmark, metadata, help, kudos)
17//! - `intent` — free-form natural-language classification (optional LLM via
18//!   Ollama, heuristic fallback)
19//! - `lemmy` — Lemmy/Piefed community monitor (poll-based)
20//! - `ratelimit` — cross-platform rate limiting (shared Redis buckets)
21//! - `debug` — diagnostics
22//!
23//! Adapters (fanfic-archivist-discord, -matrix, -telegram, -slack, -irc,
24//! -fediverse, CLI, web) depend on this crate and render `PlatformMessage`
25//! natively. This crate never imports a platform SDK.
26
27pub mod api;
28pub mod cache;
29pub mod config;
30pub mod core;
31pub mod debug;
32pub mod dispatch;
33pub mod error;
34pub mod intent;
35pub mod lemmy;
36pub mod model;
37pub mod ratelimit;
38pub mod store;
39pub mod util;
40
41pub use config::BotConfig;
42pub use error::{BotError, Result};
43
44/// Version of the bot core.
45pub const VERSION: &str = env!("CARGO_PKG_VERSION");