Skip to main content

Crate archivist_core

Crate archivist_core 

Source
Expand description

§archivist-core

Platform-neutral core for the FicHub companion bot.

This crate contains ALL business logic shared by every platform adapter:

  • api — typed FicHub REST API client (FichubClient)
  • model — response/request structs
  • cache — Redis pagination + response cache shared with FicHub
  • store — token store (/link flow) + pending-link codes
  • config — environment-driven BotConfig
  • errorBotError (no platform-specific variants)
  • util — URL detection, word formatting, truncation
  • core — the platform-neutral PlatformMessage IR + RichItem + buttons
  • dispatchCoreCtx + every do_* command (search, ask, quote, body, recs, roll, download, bookmark, metadata, help, kudos)
  • intent — free-form natural-language classification (optional LLM via Ollama, heuristic fallback)
  • lemmy — Lemmy/Piefed community monitor (poll-based)
  • ratelimit — cross-platform rate limiting (shared Redis buckets)
  • debug — diagnostics

Adapters (fanfic-archivist-discord, -matrix, -telegram, -slack, -irc, -fediverse, CLI, web) depend on this crate and render PlatformMessage natively. This crate never imports a platform SDK.

Re-exports§

pub use config::BotConfig;
pub use error::BotError;
pub use error::Result;

Modules§

api
Typed HTTP client for the FicHub REST API.
cache
Redis-backed pagination cache for list commands.
config
Bot configuration loaded from environment variables.
core
Platform-neutral message IR (intermediate representation).
debug
Automatic LLM-assisted debugging for failed search requests.
dispatch
Core command logic — platform-neutral.
error
Error types for the bot.
intent
Free-form mention handling — “talk to the Archivist and it does the thing.”
lemmy
Lemmy/Reddthat community monitor.
model
Typed response models matching the FicHub REST API.
ratelimit
Cross-platform rate limiting.
store
Redis-backed auth token store.
util
Utility helpers: supported-site URL detection, embed formatting.

Constants§

VERSION
Version of the bot core.