Architecture overview
src/xtv_support/
config/ settings, feature flags, i18n loader
core/ DI container, event bus, router, i18n, rbac, FSM
domain/ frozen models + events (no IO)
infrastructure/ db, cache, storage, telegram, ai, metrics, tracing
services/ bounded-context business logic
handlers/ pyrofork user/admin/topic/agent handlers
middlewares/ logging, rbac, i18n, blocked, cooldown, tracing
ui/ card/blockquote/progress primitives + templates
plugins/ loader + registry + builtin/* (12 builtins)
tasks/ scheduler + periodic jobs
api/ FastAPI REST app (optional)
utils/ text, time, ids, retry, crypto
locales/ en + 10 language YAMLs
Lifecycle
main.py -> xtv_support.entrypoint().
- Bootstrap builds: pyrofork Client, Container, EventBus,
FeatureFlags, StateMachine, I18n, AIClient, PluginLoader.
- Plugins are discovered, gated on their
feature_flag, started.
- The router attaches every
@Client.on_message / on_callback_query
handler defined in xtv_support.handlers.* to the live pyrofork Client.
- Background tasks (SLA sweeper, auto-close, analytics rollup,
webhook retry, weekly digest) run via the Phase-3 TaskManager.
- On shutdown the loader unloads plugins, resets i18n, closes Mongo.
See Plugins + Events for the details.